Selecting a UserProfile

440 pts.
Tags:
CL
WRKSPLF
Friends, I have this CL and this CL select all users on this command: WRKSPLF SELECT(*ALL) OUTPUT(*PRINT) In a parameter (30 days) I retain all spooled files that users. I have a unique User to and this needs reatins Your spooled file by 90 dias. How can I select this condition on my CL ? ***** The COMMAND - called DLTOLDSPLF ***** CMD PROMPT(’Delete OLD Spool Files’) PARM KWD(DIAS) TYPE(*DEC) LEN(3) MIN(1) + PROMPT(’Dias Para Reter Spool Files’) ***** The first CL - called DLTOLDSPLF ***** PGM PARM(&DIAS) DCLF FILE(DLTOLDSPLF) DCL VAR(&DIAS) TYPE(*DEC) LEN(3 0) DCL VAR(&DIF) TYPE(*DEC) LEN(5 0) DCL VAR(&DIFX) TYPE(*CHAR) LEN(5) DCL VAR(&SYSDATE) TYPE(*CHAR) LEN(6) DCL VAR(&CTDLT) TYPE(*DEC) LEN(5 0) DCL VAR(&SPLNBRAUX) TYPE(*DEC) LEN(5 0) DCL VAR(&CTDLTX) TYPE(*CHAR) LEN(5) WRKSPLF SELECT(*ALL) OUTPUT(*PRINT) CRTPF FILE(QTEMP/WRKSPLF) RCDLEN(170) SIZE(*NOMAX) MONMSG MSGID(CPF7302) CPYSPLF FILE(QPRTSPLF) TOFILE(QTEMP/WRKSPLF) + SPLNBR(*LAST) RUNQRY QRY(DLTOLDSPLF) RTVSYSVAL SYSVAL(QDATE) RTNVAR(&SYSDATE) CVTDAT DATE(&SYSDATE) TOVAR(&SYSDATE) TOFMT(*YMD) + TOSEP(*NONE) LER: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(FIM)) OVRDBF FILE(DLTOLDSPLF) TOFILE(QGPL/DLTOLDSPLF) CALL PGM(DIFDATA) PARM(&SYSDATE &SPLDAT &DIF) CHGVAR VAR(&DIFX) VALUE(&DIF) IF COND(&DIF *LE &DIAS) THEN(GOTO CMDLBL(LER)) CHGVAR VAR(&SPLNBRAUX) VALUE(&SPLNBR) DLTSPLF FILE(&SPLFNAM) JOB(&JOBNBR/&USRNAM/&JOBNAM) + SPLNBR(&SPLNBRAUX) MONMSG MSGID(CPF0000) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + MSGDTA(’Deletando o Spool ‘ *BCAT &JOBNAM + *TCAT ‘/’ *TCAT &USRNAM *TCAT ‘/’ *TCAT + &JOBNBR *BCAT ‘de’ *BCAT &SPLDDMMYY *BCAT + ‘No Sistema por mais de’ *BCAT &DIFX + *BCAT ‘dias’) TOPGMQ(*EXT) MSGTYPE(*STATUS) CHGVAR VAR(&CTDLT) VALUE(&CTDLT + 1) GOTO CMDLBL(LER) ERROR: DMPCLPGM SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(’Erro No + Programa, verifique O JobLog’) + MSGTYPE(*ESCAPE) RETURN FIM: CHGVAR VAR(&CTDLTX) VALUE(&CTDLT) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&CTDLTX + *BCAT ‘Spoolfiles Deletados’) MSGTYPE(*COMP) ENDPGM ***** The second CL - called DIFDATA ***** PGM PARM(&DATA1 &DATA2 &DIF) DCL VAR(&DATA1) TYPE(*CHAR) LEN(6) DCL VAR(&DATA2) TYPE(*CHAR) LEN(6) DCL VAR(&DATA1J) TYPE(*CHAR) LEN(5) DCL VAR(&DATA2J) TYPE(*CHAR) LEN(5) DCL VAR(&DIF) TYPE(*DEC) LEN(5 0) DCL VAR(&DIFDIA) TYPE(*DEC) LEN(5 0) DCL VAR(&DIFANO) TYPE(*DEC) LEN(5 0) DCL VAR(&ANO1) TYPE(*DEC) LEN(4 0) DCL VAR(&DIA1) TYPE(*DEC) LEN(3 0) DCL VAR(&ANO2) TYPE(*DEC) LEN(4 0) DCL VAR(&DIA2) TYPE(*DEC) LEN(3 0) CVTDAT DATE(&DATA1) TOVAR(&DATA1J) FROMFMT(*YMD) + TOFMT(*JUL) TOSEP(*NONE) CVTDAT DATE(&DATA2) TOVAR(&DATA2J) FROMFMT(*YMD) + TOFMT(*JUL) TOSEP(*NONE) CHGVAR VAR(&ANO1) VALUE(%SST(&DATA1J 1 2)) CHGVAR VAR(&ANO2) VALUE(%SST(&DATA2J 1 2)) CHGVAR VAR(&DIA1) VALUE(%SST(&DATA1J 3 3)) CHGVAR VAR(&DIA2) VALUE(%SST(&DATA2J 3 3)) IF COND(%SST(&DATA1 1 1) *GE ‘8′) THEN(CHGVAR + VAR(&ANO1) VALUE(&ANO1 + 1900)) ELSE CMD(CHGVAR VAR(&ANO1) VALUE(&ANO1 + 2000)) IF COND(%SST(&DATA2 1 1) *GE ‘8′) THEN(CHGVAR + VAR(&ANO2) VALUE(&ANO2 + 1900)) ELSE CMD(CHGVAR VAR(&ANO2) VALUE(&ANO2 + 2000)) CHGVAR VAR(&DIFDIA) VALUE(&DIA1 - &DIA2) CHGVAR VAR(&DIFANO) VALUE(&ANO1 - &ANO2) IF COND(&DIFDIA *LT 0) THEN(DO) CHGVAR VAR(&DIFANO) VALUE(&DIFANO - 1) CHGVAR VAR(&DIFDIA) VALUE(&DIFDIA + 365) ENDDO CHGVAR VAR(&DIF) VALUE((&DIFANO * 365) + &DIFDIA) ENDPGM ***** The Query - called DLTOLDSPLF ***** 5722QU1 V5R3M0 040528 IBM Query for AS/400 18:50:53 Page 1 Query . . . . . . . . . . . . . . . . . DLTOLDSPLF Library . . . . . . . . . . . . . . . QGPL Query text . . . . . . . . . . . . . . Extrai dados de WRKSPLF *ALL Query CCSID . . . . . . . . . . . . . . 65535 Query language id . . . . . . . . . . . ENU Query country or region id . . . . . . US *** . is the decimal separator character for this query *** Collating sequence . . . . . . . . . . Hexadecimal Processing options Use rounding . . . . . . . . . . . . Yes (default) Ignore decimal data errors . . . . . No (default) Ignore substitution warnings . . . . Yes Use collating for all compares . . . Yes Selected files ID File Library Member Record Format T01 WRKSPLF QTEMP *FIRST WRKSPLF Result fields Name Expression Column Heading Len Dec SPLFNAM SUBSTR(WRKSPLF,2,10) USRNAM SUBSTR(WRKSPLF,13,10) PRTDEV SUBSTR(WRKSPLF,24,10) USRDTA SUBSTR(WRKSPLF,35,10) STATUS SUBSTR(WRKSPLF,46,3) TOTPAG SUBSTR(WRKSPLF,51,5) SPLDAT SUBSTR(WRKSPLF,89,2)|| SUBSTR(WRKSPLF,86,2)|| SUBSTR(WRKSPLF,83,2) SPLTIM SUBSTR(WRKSPLF,92,8) SPLNBR SUBSTR(WRKSPLF,102,5) JOBNAM SUBSTR(WRKSPLF,108,10) JOBNBR SUBSTR(WRKSPLF,119,6) QNAM SUBSTR(WRKSPLF,126,10) QLIB SUBSTR(WRKSPLF,137,10) SPLDDMMYY SUBSTR(WRKSPLF,83,2)|| ‘/’ || SUBSTR(WRKSPLF,86,2)|| ‘/20′ || SUBSTR(WRKSPLF,89,2) IBM Query for AS/400 27/06/08 18:50:53 Page 2 Select record tests AND/OR Field Test Value (Field, Numbers, or ‘Characters’) SPLFNAM NLIST ‘5722SS1 V’ ‘File ‘ AND SPLFNAM NLIST ‘ * ‘ ‘ ‘ Ordering of selected fields Field Sort Ascending/ Break Field Name Priority Descending Level Text SPLFNAM USRNAM PRTDEV USRDTA STATUS TOTPAG SPLDAT 10 A SPLTIM SPLNBR JOBNAM JOBNBR QNAM QLIB SPLDDMMYY Report column formatting and summary functions Summary functions: 1-Total, 2-Average, 3-Minimum, 4-Maximum, 5-Count Overrides Field Summary Column Dec Null Dec Numeric Name Functions Spacing Column Headings Len Pos Cap Len Pos Editing SPLFNAM 0 SPLFNAM 10 USRNAM 2 USRNAM 10 PRTDEV 2 PRTDEV 10 USRDTA 2 USRDTA 10 STATUS 2 STATUS 3 TOTPAG 2 TOTPAG 5 SPLDAT 2 SPLDAT 6 SPLTIM 2 SPLTIM 8 SPLNBR 2 SPLNBR 5 JOBNAM 2 JOBNAM 10 JOBNBR 2 JOBNBR 6 QNAM 2 QNAM 10 QLIB 2 QLIB 10 SPLDDMMYY 2 SPLDDMMYY 10 IBM Query for AS/400 27/06/08 18:50:53 Page 3 Selected output attributes Output type . . . . . . . . . . . . . . Database file Form of output . . . . . . . . . . . . Detail Line wrapping . . . . . . . . . . . . . No Database file output File . . . . . . . . . . . . . . . . . DLTOLDSPLF Library . . . . . . . . . . . . . . . QGPL Member . . . . . . . . . . . . . . . . *FILE Data in file . . . . . . . . . . . . . Replace file For a new file: Authority . . . . . . . . . . . . . . *ALL Text about the file . . . . . . . . . . . . . Extrai dados de WRKSPLF *ALL Print definition . . . . . . . . . . . No Output file record format Output record length . . . . . . . . . 113 Field list: Field Begin Len Dec Null Data Type Text SPLFNAM 1 10 Character SUBSTR(WRKSPLF,2,10) USRNAM 11 10 Character SUBSTR(WRKSPLF,13,10) PRTDEV 21 10 Character SUBSTR(WRKSPLF,24,10) USRDTA 31 10 Character SUBSTR(WRKSPLF,35,10) STATUS 41 3 Character SUBSTR(WRKSPLF,46,3) TOTPAG 44 5 Character SUBSTR(WRKSPLF,51,5) SPLDAT 49 6 Character SUBSTR(WRKSPLF,89,2)|| SUBSTR(WRKSPLF,86 SPLTIM 55 8 Character SUBSTR(WRKSPLF,92,8) SPLNBR 63 5 Character SUBSTR(WRKSPLF,102,5) JOBNAM 68 10 Character SUBSTR(WRKSPLF,108,10) JOBNBR 78 6 Character SUBSTR(WRKSPLF,119,6) QNAM 84 10 Character SUBSTR(WRKSPLF,126,10) QLIB 94 10 Character SUBSTR(WRKSPLF,137,10) SPLDDMMYY 104 10 Character SUBSTR(WRKSPLF,83,2)|| ‘/’ || SUBSTR(WRKSPLF,86
ASKED: July 24, 2008  2:34 PM
UPDATED: July 24, 2008  11:31 PM

Answer Wiki

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

Hi Silvarb,

After this line :-

IF COND(&DIF *LE &DIAS) THEN(GOTO CMDLBL(LER))

Check if the user is the one you need to keep spooled files for :-

IF COND(&USRNAM *EQ “YOURUSER”) THEN(GOTO CMDLBL(LER))

This will then skip processing the spooled files for YOURUSER.

Replace the YOURUSER with the profile you need to keep the spooled files for.

Regards,

Martin Gilbert.

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
  • SILVARB
    Thanks Martin, But which now hold for 90 days the files of this user "YOURUSER" and the 30 days after the others "*ALL"" ?
    440 pointsBadges:
    report
  • Gilly400
    Hi Silvarb, I see what you mean. Then you could try this :- IF COND(&USRNAM *EQ "YOURUSER" *AND (&DIF *LE (&DIAS + 60))) THEN(GOTO CMDLBL(LER)) Then it should keep the spooled files for YOURUSER for 60 days more than all the other users. Regards, Martin.
    23,730 pointsBadges:
    report
  • SILVARB
    Martin, to me ....You are the best ! Thanks one more time. OBS: Now the CL works. SILVARB
    440 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