How to get the “Named-FIRST MBR” in a CL/400 pgm

560 pts.
Tags:
AS/400
CL/400
MBR
How to access the "FIRST MBR" of a multi-membered file in a CL/400 program. my scenario ------------ I have a multi-membered file called WKSLSP, which has MBRs in the following format either MSPmmddyyn or FDBmmddyyn;(where mmddyy is the JOB-DATE and 'n' is the sequence number) like :- FDB100510A  FDB100510B  FDB1005106 MSP1005103  MSP1005105 The Seq. no.(n) may range from A to Z first, and then 1 to 9. So the first member on any given day will look like FDB091510A and the second one will look like FDB091510B & so on, till FDB091510Z and FDB0915101, FDB0915102,.. till FDB0915109 in that sequence only. The program will be called with a parameter (either 'FDB' or 'MSP') I need to pick-up the FIRST MBR of either 'FDB' or 'MSP', based on the above parameter passed, in the above mentioned sequence. This seq. no. is required, as they may send us more than 1 file per day on any given day & and both 'MSP' & 'FDB' can come on the same day as well. example: In the above mentioned example... If I call the program with parm 'FDB', it should pickup "FDB100510A" as the first MBR. If there are no "FDB100510A" or "FDB100510B", then "FDB1005106" should be picked up. Same is the case with 'MSP' also(i.e. "MSP1005103" should be picked up as the first MBR) Any help would be greatly appreciated. Thanks in Advance, Svanky

Software/Hardware used:
AS/400, CL/400
ASKED: October 5, 2010  4:02 PM
UPDATED: October 5, 2010  10:41 PM

Answer Wiki

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

One way to do it is have a loop in your CL prorgam that does a RTVMBRD.
PGM &InType
DCL &InType *CHAR 3 (This will be either FDB or MSP)
DCL &SEQ *CHAR 35 VALUE(‘ABCDEF….XYZ123…789′)

Next retrieve the currect data in mmddyy format.
Now *CAT the two fields.
Now do a loop changes the last character with a substring from &SEQ, using the RTVMBRD and a MONMSG to see if the member exists.

Discuss This Question: 1  Reply

 
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
    Note that the MBR() parameter of RTVMBRD is a "Reference member" that can include a "Relationship". That can make the loop more intelligent. The MBR() help text describes differences between *FIRST and *FIRSTMBR (or named members) and how they result in date-ordered or name-ordered lists. I'd probably use the List Database File Members (QUSLMBR) API, but RTVMBRD is comfortable and relatively easy for most developers. 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