Logical File

15 pts.
Tags:
AS/400 logical file
COBOL
iSeries 820
Hi, I have written two online programs.  The first one uses PRDATA-FILE.  The second one uses a logical file based on PRDATA-FILE.  When the screen of the first online program is displayed, the screen of the second online program does not display records.  Is this because PRDATA-FILE is locked by the first online program? How do I make the second online program display records? Thanks in advance.

Software/Hardware used:
iSeries 820 / COBOL

Answer Wiki

Thanks. We'll let you know when a new response is added.

It has been 23 years since I’ve even looked at a COBOL program.

When you call the second ‘online’ program and the screen without records is shown, go to another session and type WRKOBJLCK PRDATA-FILE *FILE and see what kind of locks are on the file and where they are.
In RPG, if you are not updating, the file would be defined as Input Only. Or, if the program does update, but not while retreiving records, you would read(n) or chain(n) (no lock) until right before actually wanting to write or update the file. Then read/chain without the (n) and write/update. When you write/update the file record is unlocked.

Another option is in program 1, close the file before calling program 2.

All of this said IF the issue is a file/record lock.

It could just be a key out of whack or your code. Please send code….

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    Not a COBOL guy but ... COBOL would not normally lock the file in a way that would prevent it's use by other programs. If it's accessing the records for update it will lock the record(s). Your second program would not have a problem unless it's attempting to access
      for update
    a locked record. The number of records locked would depend on COMMIT level (if you are using Commitment Control). Phil
    49,590 pointsBadges:
    report
  • TomLiotta
    How do I make the second online program display records? If we can't see the relevant code for both programs, and the relevant definitions of the files, we can't guess where something might be going wrong. Show us what is running, please. Tom
    125,585 pointsBadges:
    report
  • Splat
    What happens if you run the second program without running the first online program?
    6,885 pointsBadges:
    report
  • Elliet
    Thanks for all your responses. The two programs are independent of each other. They both use PRDATA-FILE. When either is up on one session, the other program hangs in another session. Would like to know the syntax or technique to use for file sharing. Thanks in advance.
    15 pointsBadges:
    report
  • TomLiotta
    Would like to know the syntax or technique to use for file sharing. Generally, sharing is the default. Usually, the question would be about how not to share. We're likely to ask you what you're doing to block sharing. When either is up on one session, the other program hangs in another session. Any answers are likely to come out of information about that. What do you mean by "the other program hangs"? What exactly do you see? What is the exact behavior that is visible? Does the hanging program fail to start at all? Can both programs start, but one program begins to "hang" later? If you wait a couple minutes, does any error message appear? Does the hanging program become free if you end the first program? Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Are these programs designed to update existing data? Please show us the file declaration section of your programs. Thanks Phil
    49,590 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following