Manipulating members using CL

pts.
Tags:
Programming Languages
I'm trying to build a CL program that will read a physical file and check the creation date of each member against my criteria. Unfortunately, I have almost zero experience with CL and file handling, so I haven't the foggiest how to manage this. My questions are as follows: 1. Is there some syntax to loop through a file so I can look at each member? 2. Can I check a member's creation date? 3. If not, since my member names are date specific, can I dump the name into a variable to do my string manipulation and, if so, how? Any suggestions would be greatly appreciated. Thanks, Matt Tatham

Answer Wiki

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

I have used the following logic to extract information about members in a few programs. There is no need to declare the variables found in the file as once the file is declared the CL knows the variables. You need to run the command to create the list once so that the file exists before running the CL.

DCLF FILE(MYLIB/MYDATAFILE)

DSPFD FILE(MYLIB/*ALL) TYPE(*MBRLIST) +
OUTPUT(*OUTFILE) OUTFILE(MYLIB/MYDATAFILE)

LOOP: RCVF

/*===============================================*/
/* When we reach the end of the file we are done */
/*===============================================*/
MONMSG CPF0864 EXEC(GOTO ENDLOOP)

/*===============================================*/
/* Decision and testing logic */
/*===============================================*/
IF COND(&MLCDAT *EQ ’041001′) THEN(GOTO +
CMDLBL(LOOP))

ENDLOOP: /*===============================================*/
/* place code here for processing after you have */
/* read the file to end */
/*===============================================*/

Field Type Length
MLRCEN CHARACTER 1
MLRDAT CHARACTER 6
MLRTIM CHARACTER 6
MLFILE CHARACTER 10
MLLIB CHARACTER 10
MLFTYP CHARACTER 1
MLFILA CHARACTER 4
MLMXD CHARACTER 3
MLFATR CHARACTER 6
MLSYSN CHARACTER 8
MLASP DECIMAL 3
MLRES CHARACTER 4
MLNOMB DECIMAL 5
MLNAME CHARACTER 10
MLNRCD DECIMAL 10
MLNDTR DECIMAL 10
MLSIZE DECIMAL 10
MLSEU CHARACTER 4
MLCCEN CHARACTER 1
MLCDAT CHARACTER 6
MLCHGC CHARACTER 1
MLCHGD CHARACTER 6
MLCHGT CHARACTER 6
MLMTXT CHARACTER 50
MLSEU2 CHARACTER 10
MLUCEN CHARACTER 1
MLUDAT CHARACTER 6
MLUCNT DECIMAL 5
MLTCEN CHARACTER 1
MLTDAT CHARACTER 6
MLSIZ2 DECIMAL 15
MLSTFR CHARACTER 1

Here are the field descriptions

MLRCEN Retrieval century: 0=19xx,
MLRDAT Retrieval date: year/month/
MLRTIM Retrieval time: hour/minute
MLFILE File
MLLIB Library
MLFTYP P=PF, L=LF, R=DDM PF, S=DDM
MLFILA File attribute: *PHY or *LG
MLMXD Reserved
MLFATR File attribute: PF, LF, PF
MLSYSN System Name (Source System,
MLASP Auxiliary storage pool ID:
MLRES Reserved
MLNOMB Number of members
MLNAME Member
MLNRCD Current number of records
MLNDTR Number of deleted records
MLSIZE Data space and index size i
MLSEU Source type for S/38 View a
MLCCEN Member creation century: 0=
MLCDAT Member creation date: year/
MLCHGC Last change century: 0=19xx
MLCHGD Last change date: year/mont
MLCHGT Last change time: hour/minu
MLMTXT Text ‘description’
MLSEU2 Source type
MLUCEN Last Used Century: 0=19xx,
MLUDAT Last Used Date: year/month/
MLUCNT Days Used Count
MLTCEN Usage Data Reset Century: 0
MLTDAT Usage Data Reset Date: year
MLSIZ2 Data space and index size i
MLSTFR Member storage freed Y=Yes

I hope that this helps.

Keith Bradshaw

Discuss This Question:  

 
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

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