Need Help to Write a Code in CL400 to Access All Members of Library in CL400 , and If to find one particular pgm how can i do it ???

40 pts.
Tags:
AS/400
AS/400 Library
CL/400
Need Help to Write a Code in CL400 to Access All Members of Library in CL400 , and If I want to find one particular pgm thru the same pgm how can i do it ???(FNDSTRPDM) , possiblity to use it and I want to have one sample code does any one knw's it then let me know it too ! .

 



Software/Hardware used:
CL400 , DSPF (Display File - SDA)

Answer Wiki

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

First CL
Use DSPFD command
F4 to prompt
Enter library
File name or *ALL
Type MBRLST
Output Outfile
Name Outfile/library
Call second CL

Second cl using DcLF to the outfile
RCV records from outfile
… whatever
loop

before compiling the second cL you will have to create the outfile

Discuss This Question: 3  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
  • TomLiotta
    ...to Access All Members of Library in CL400 , and If I want to find one particular pgm... The first decision is to determine if the program is OPM or ILE. ILE programs don't have source; only modules have source. If it's OPM, you can run:
    DSPOBJD OBJ( mylib/mypgm ) OBJTYPE(*PGM) DETAIL(*SERVICE)
              OUTPUT(*OUTFILE) OUTFILE(QTEMP/OBJD)
    The OBJD file can then be read with RCVF. The ODSRCF field has source file name; ODSRCL has the source file library; and ODSRCM has the member name. The values in those fields identify the source member that the OPM object was created from. The member name does not need to match the object (program) name; so if you search for a member, you might not find a match. If you run the same command against an ILE program, the source fields will be blank. That's an indication that the program has no source. You need to look at the modules to find the source that they were created from. An ILE program can have meny modules. (Which module do you want the source for?) And the source members' names do not need to match the modules' names nor the program name. If the program is ILE, maybe you should be looking for module source rather than program source. The DSPOBJD command can be run against the *MODULE object just like it can for a *PGM object. The source file, library and member it was created from are in the same fields. You can list all source members in your system. You can match their names against program names. Names probably will match. You might have multiple members with the same name -- which one was used when creating the *PGM? Generally, the problem that you asked about would indicate that the system has very poor source control. Apparently you can't trust what the system tells you about the object. Otherwise you could simply look at the object description and know what the source member was. But if you can't trust that information, why would you expect to trust anything else? I run commands from the job scheduler every night (or every week) to build a file of every source file on the system. Then every source file is processed to list its members into a "member list" file. That gives me a file that I can query at any time to locate any member name. I can use interactive SQL or any programming that I can write. If your question comes because you cannot trust your objects, then what problem are you trying to solve? Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    before compiling the second cL you will have to create the outfile But note that the file already exists. That is, it's not the file that is important; it is the format that is important. The format exists in the system ASP because it is from file QSYS/QAFDMBRL when *MBRLIST is specified. (The format is QWHFDML.) This means you can compile over QSYS/QAFDMBRL and simply use OVRDBF at run-time to point to the file that you created. The DSPFD help text for the OUTFILE() parameter lists the files (and formats) that act as the model files. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Call second CL Note that a single CL program is all that's needed. A reason to write and call a second program might be if you wanted to call the second program from other OPM programs. You might even create both as procedures rather than programs (if you had a reason to create two instead of just one.) Tom
    125,585 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