Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:43:17+00:00 2026-06-02T19:43:17+00:00

Is there a way to use the variable of a procedure(.p file) in its

  • 0

Is there a way to use the variable of a procedure(.p file) in its internal procedure (.p file)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:43:18+00:00Added an answer on June 2, 2026 at 7:43 pm

    The actual problem seems to be: “I have many procedures that call a common procedure. In one special case I need to have the common procedure set a special value in the calling procedure but I cannot modify all of the others.”

    The simple, but architecturally repugnant, solution is to use a global shared variable.

    Many people will tell you that this is a bad coding technique. They are right. But you aren’t asking for advice on best practices.

    Simply create such a variable in both the caller and the callee. Procedures that don’t need it won’t miss it.

    One of your “normal” programs:

    /* p1.p */
    
    message "p1, I'm normal.".
    run common.p.
    

    Your “special” program:

    /* p2.p */
    
    define new global shared variable special as character no-undo.
    
    message "p2, I'm special!".
    run common.p.
    message "special = " special.
    

    The common program:

    /* common.p */
    
    define new global shared variable special as character no-undo.
    message "common stuff...".
    if program-name(2) = "p2.p" then special = "special value".
    return.
    

    You can define a NEW GLOBAL SHARED variable as many times as you like and you only get one copy of it. The “new” doesn’t overwrite any existing variables (if you leave out GLOBAL it behaves differently).

    You didn’t ask for it and maybe you don’t need it but the program-name(2) check peeks at the call stack to see if common.p was called by p2.p.

    There are other, more complicated ways to do this but they all boil down to the same problem — you’re creating the basis for some very ugly coupling between your “special” program and the now no longer generic “common” program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to use a variable in the actual $_FILES['file'] section? I
Is there a way to use a reference as a member variable without initialising
Is there a way to use the same variable numerous times in a prepared
Possible Duplicate: Use a variable to define a PHP function Is there a way
Is there a way to use a variable in the following manner? DECLARE @ID
In python, is there a way I can use instance variables as optional arguments
Is there any way to use Google's API to retrieve a user's current zipcode
Is there a way to use the win32clipboard module to store a reference to
Is there a way to use lapply() in a manner that forces it to
Is there a way to use a different css for Android than is used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.