Some important things are missing into your program.
The dspfd *MBRLIST into an outfile would give you a list of all members. The variable name contaninig the members is “MLNAME” in the outfile.
If I were you, I would rather do it that way:
- Consider that the program called (line 8.00) is the one who will tell you if the account in gound or not. This program should initialize the &FOUND variable to ‘N’ before doing it’s verification.
- Consider to call the actual program with a parameter giving the file name to verify.
- Consider that before compiling that program, you will have to create a file into QTEMP named MBRLIST by doing a DSPFD with and outfile named MBRLIST in QTEMP and compile interractively.
Here we go !
0001.00 PGM PARM(&FILE)
0002.00 DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
0002.01 DCL VAR(&FOUND) TYPE(*CHAR) LEN(1)
0002.02 DCLF FILE(QTEMP/MBRLIST)
0003.00 DSPFD FILE(YOURLIB/&FILE) TYPE(*MBRLIST) +
0004.00 OUTPUT(*OUTFILE) OUTFILE(QTEMP/MBRLIST)
0005.00 LOOP: RCVF RCDFMT(QWHFDML)
0006.00 MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDPGM))
0007.00 OVRDBF FILE(&FILE) TOFILE(YOURLIB/&FILE) MBR(&MLNAME)
0008.00 CALL PGM(YOURLIB/YOURPGM) PARM(&FOUND)
0008.01 DLTOVR FILE(&FILE)
0009.00 IF COND(&FOUND = ‘Y’) THEN(DO)
0010.00 /* HERE YOU DO WHATEVER IT TAKE’S IF THE ACCOUNT IS FOUND */
0012.00 GOTO CMDLBL(LOOP)
0013.00 ENDPGM: ENDPGM
Have fun !