Database fields as part of Data Structure in a Service program getting blanked out

30 pts.
I've a file HPHOSP having patient details. It has 8 fields to store diagnosis codes - LPCD01, LPCD02....LPCD08. I've declared these fields as a part od DS so that these can be accessed by array LPCD.

Now in my program, when I chain file HPHOSP, then all fields fo file has correct value but these 8 fields (LPCD*) always has blank value, although these are non-blank in database file.

The above code is part of a procedure. File HPHOSP is declared in F-specs at global level and not inside procedure. And this procesure is part of a service program.

What could be the reason for this:

1. Is it because file is declared in global F-specs and not inside procedure definition?

2. This is part of service program that is inducing some error?

3. Any other reason.

0085.00      D                 DS                                     0086.00      D  LPCD                   1     64                       0087.00      D                                     DIM(8)             0088.00      D  LPCD01                 1      8                       0089.00      D  LPCD02                 9     16                       0090.00      D  LPCD03                17     24                       0091.00      D  LPCD04                25     32                       0092.00      D  LPCD05                33     40                       0093.00      D  LPCD06                41     48                       0094.00      D  LPCD07                49     56                       0095.00      D  LPCD08                57     64                      



Software/Hardware used:
AS400. OS/400 V6R1

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 4  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.
  • philpl1jb
    0085.00      D                 DS                                    
    0086.00      D  LPCD                   1     64                       
    0087.00      D                                                      DIM(8)             
    0088.00      D  LPCD01                 1      8                       
    0089.00      D  LPCD02                 9     16                       
    0090.00      D  LPCD03                17     24                       
    0091.00      D  LPCD04                25     32                       
    0092.00      D  LPCD05                33     40                       
    0093.00      D  LPCD06                41     48                       
    0094.00      D  LPCD07                49     56                       
    0095.00      D  LPCD08                57     64       
    This might make the code a bit clearer.
    54,090 pointsBadges:
  • philpl1jb
    This is part of a procedure. Is the F spec and chain in a different procedure? Does the F spec include a PreFix keyword?
    54,090 pointsBadges:
  • TomLiotta
    Since LPCD is defined as 64 bytes in length, it appears that you want an array that is 512 bytes long. (I.e., DIM(8) * 64 = 512 ) But your file fields are only 8 bytes long...? So, do you really want all of your file fields to overlay just the first element of your array? If the LPCDnn fields are in a subprocedure, how are you putting the values from the file into those fields? They won't be populated by reading records. You can't define a memory layout in a subprocedure that affects where the main procedure stores its data. The fields in the subprocedure are different variables from those in the main procedure, even though they might have the same names. Tom
    125,585 pointsBadges:
  • philpl1jb
    Yup, Tom has got it, he always does. LPCD should be 8A DIM(8) and if you move the structure to the mainline or pass the variables to the procedure you'll be cooking. Variables like LPCD01 defined in a procedure are local (even if they have the same name as a global variable they don't share a memory area or data. That's the scope thing. webcam.on.Phil
    54,090 pointsBadges:

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.

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


Share this item with your network: