How to delete spool files of specific user and job

1590 pts.
Tags:
AS/400
Hi, I want to delete spool files of specfic user and job how can that be done through CL program? Also there is another condition that only those spool files needs to be deleted whose status is either 'HLD' or 'RDY' Thanks

Answer Wiki

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

I have written this program since i hwanted only those spooled files to be deleted whose status is either HLD
OR RLS.
and I don’t think without a program this could have been possible.
following command will delete all spool files for user JKJK
DLTSPLF FILE(*SELECT) SELECT(JKJK)

but what if i want to
delete only those whose staus is either HLD or RDY.

Please correct me if tit could also have been done in other way or in other programming approach or through some other
logic without creation of Logical file and flat file.

Thanks

Discuss This Question: 38  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
  • 6r
    I tried to write following CLLE program:- PGM DCLF FILE(JKJK1/MYFILE4) READ: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND(&USER *EQ JKJK *AND &STS *EQ HLD *OR + &STS *EQ RDY) THEN(DO) DLTSPLF FILE(&FILE) JOB(&JNO/&USER/&JOB) SPLNBR(&SPNO) MONMSG MSGID(CPF0000) ENDDO GOTO CMDLBL(READ) END: ENDPGM Here myfile4 is derived as followings: sequential steps- 1) WRKSPLF SELECT(JKJK) OUTPUT(*PRINT) 2)wrkjob 3)select option 4 wrk with spooled files and in QPRTSPLF all desired data comes. 4) CPYSPLF FILE(QPRTSPLF) TOFILE(N12) (N12 was created as a flat file using crtpf with record length 200. 5) DDS Of Myfile4 which is LF(Used in above CLLE program) based on flat file N12:- R REC1 PFILE(JKJK1/N12) FILE I SST(N12 1 9) USER I SST(N12 13 8) FILENBR I SST(N12 114 3) JOB I SST(N12 108 10) NUMBER I SST(N12 119 6) STS I SST(N12 46 3) Here actually the main problem is that value in filenumber(which is spool file number) is not equal to the value of spool file number in flat file n12 whereas rest 5 fields are same as n12 (i mean thier values) so because of this reason i doubt my above clle program not deleting any spool file for that speific user 'JKJK' whose spooled files are either in 'HLD' or ;RDY' status. Any correction/suggestion in above program or in DDS of LF to obtain the desired results? Thanks T
    1,590 pointsBadges:
    report
  • TomLiotta
    Your programming is fair. It does have some logical problems, and it could be done in a much better way. We can look at the logical problems first. <code> IF COND(&USER *EQ JKJK *AND &STS *EQ HLD *OR +&STS *EQ RDY) THEN(DO) </code> That statement should be written this way: <code> IF COND(&USER *EQ JKJK *AND (&STS *EQ HLD *OR +&STS *EQ RDY)) THEN(DO) </code> The *AND logical operator takes precedence over *OR. In order to force the *OR condition to resolve as a single logical expression, it must be wrapped in its own set of parentheses.   Next, you are using JOB(&JNO/&USER/&JOB) and SPLNBR(&SPNO) in your DLTSPLF command, but I don't see &JNO and &SPNO defined anywhere.   In your LF, you have this field: <code> FILENBR      I  SST(N12 114 3) </code> It looks like you might want that to be your &SPNO field. On my i 6.1 system, the spool file number would be 4 characters in length and begins in position 103. The FILE field is also off by one position. I don't know what the values would be on your system because they are not guaranteed to be consistent.   There are other possible changes, but you didn't say what the OS version is when you create your objects and when you run your program. Using an IBM-created spooled file as input is not guaranteed to give the same results every time. The format can change for a few different reasons.   For a simple function like yours, it's probably okay. You can't rely on it for long-term production use though.   Still, there is one more problem for your case. When you get the spool file number from the file that you created, the value will be '  1' or some other value that has leading blanks in it. You can't use blanks in that parameter. It has to be a fully numeric value (or one of the allowed spacial values). You will need to replace all leading blanks with zeros if you want to do it this way.   If you get this working, you might want to try the recommended way to do this. You will want to get the experience of getting this correct first.   Tom
    125,585 pointsBadges:
    report
  • 6r
    Sorry the corrected DDS of LF was not posted its like following: with modification in File position- *************** Beginning of data ****************************** 0001.00 R REC1 PFILE(JKJK1/N12) 0002.00 FILE I SST(N12 1 10) 0003.00 USER I SST(N12 13 8) 0003.01 SPNO I SST(N12 103 3) 0003.02 JOB I SST(N12 108 10) 0003.03 JNO I SST(N12 119 6) 0004.00 STS I SST(N12 46 3) and The version I am running this program is on V5R3M0. Still, there is one more problem for your case:- How can i resolve this problem i mean sst function works for character fields only and if i make it numeric then i can't use SST to filter spool file number from my flat file in my logical file MYFILE4. So the values with leading blanks could be avoided ..etc. plus in IF condition how to fix it if *AND taking precedence over *OR, IF COND(&USER *EQ JKJK *AND &STS *EQ HLD *OR + &STS *EQ RDY) THEN(DO) Thanks
    1,590 pointsBadges:
    report
  • TomLiotta
    if i make it numeric then i can’t use SST to filter spool file number from my flat file in my logical file MYFILE4.   You can make the value numeric after you retrieve the substring from the file. For you, the easiest is probably checking the first character for a blank. If it's blank, use CHGVAR to change it to '0'. Then check the second character; and if it's blank, change it to '0'. When the leading blanks have been changed to zeros, it should be accepted by the command.   That's not always a good way to do it, but you were using only a 3-character substring. That means you would only have two blanks at most.if (%sst(&SPNO 1 1) *eq ' ') then(chgvar %sst(&SPNO 1 1) '0') ...in IF condition how to fix it if *AND taking precedence over *OR.   You fix that the way I put in my previous comment. Put the extra parentheses into the condition just like I showed.   Tom
    125,585 pointsBadges:
    report
  • 6r
    I tried to modify code as following but still not a single spool file being deleted for the user JKJK whose status are either 'HLD' or 'RDY'.one more thing as i said earlier that there is differece between spool file number value of flat file N12 and in the Logical file Myfile4. RUNQRY () N12:- Display Data Data width . . . . . . : 1000 Position to line . . . . . Shift to column . . . . . . ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10....+...11....+...12....+...13. N12 5722SS1 V5R3M0 040528 Work With All Spooled Files PUB1 12/09/12 8:50:05 Page 1 Device or Total Cur Creation Creation File File User Queue User Data Sts Pages Page Copy Form Type Pty Date Time Nbr Job Number Queue CSPOOL JKJK JKJK RDY 2 1 *STD 5 12/08/12 14:15:10 4 QPADEV000Z 500052 JKJK CSPOOL JKJK JKJK RDY 3 1 *STD 5 12/08/12 14:27:37 5 QPADEV000Z 500052 JKJK QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 303 1 *STD 5 12/08/12 14:27:47 6 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 317 1 *STD 5 12/08/12 14:27:48 7 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:48 8 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:49 9 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:50 10 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:50 11 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:51 12 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:52 13 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:53 14 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:54 15 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:55 16 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:55 17 QPADEV000Z 500052 QEZJOB QPJOBLOG JKJK QEZJOBLOG QPADEV000Z RDY 320 1 *STD 5 12/08/12 14:27:56 18 QPADEV000Z 500052 QEZJOB More... F3=Exit F12=Cancel F19=Left F20=Right F21=Split F22=Width 80 and For logical file created by me Myfile4: Runqry () Myfile4:- Display Data Data width . . . . . . : 51 Position to line . . . . . Shift to column . . . . . . ....+....1....+....2....+....3....+....4....+....5. FILE USER SPNO JOB JNO STS 5722SS1 R3M0 0 age 1 All Fil File User Nbr Job Number Sts CSPOOL JKJK QPADEV000Z 500052 RDY CSPOOL JKJK QPADEV000Z 500052 RDY QPJOBLOG JKJK QPADEV000Z 500052 RDY QPJOBLOG JKJK QPADEV000Z 500052 RDY QPJOBLOG JKJK QPADEV000Z 500052 RDY QPJOBLOG JKJK QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY QPJOBLOG JKJK 1 QPADEV000Z 500052 RDY More... F3=Exit F12=Cancel F19=Left F20=Right F21=Split F22=Width 80 Note :--Just to catch quickly spool file number value is 4 for flat file N12 where as in logical file the value is blank why this is happening.Even though the LF is based on flat file N12 only. Modified program as per suggestion:- PGM DCLF FILE(JKJK1/MYFILE4) READ: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND(%SST(&SPNO 1 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 1 1)) VALUE('0')) IF COND(%SST(&SPNO 2 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 2 1)) VALUE('0')) IF COND(&USER *EQ JKJK *AND (&STS *EQ HLD *OR + &STS *EQ RDY)) THEN(DO) DLTSPLF FILE(&FILE) JOB(&JNO/&USER/&JOB) SPLNBR(&SPNO) MONMSG MSGID(CPF0000) ENDDO GOTO CMDLBL(READ) END: ENDPGM
    1,590 pointsBadges:
    report
  • 6r
    when i said spool file number 4 i meant the comparasion between very first recod it self tells there is difference like for spool file cspool spool file number is 4 in flat file N12 where as in Logical file Myfile 4 has blank value in corresponding spool file number field. What causes this differece between flat file and logical file. I have used CHGVAR also as per suggestion but even though i can't see any single spool file is being deleted by calling my clle program. I strongly doubt this program is not functioning as desired because of this incorrect spool file number field value.Because if program does not have correct spool file number thn how will it delete it? Please correct me i f i am wrong and kindly advise to make it run successful. Thanks
    1,590 pointsBadges:
    report
  • philpl1jb
    It appears that you've got the spool file number incorrect.I'm not sure but it looks like the spool file number is located at 113 . 3 
    50,860 pointsBadges:
    report
  • TomLiotta
    In your corrected DDS for MYFILE4, you have this line: 0003.01                   SPNO               I      SST(N12    103 3)   You have SPNO starting in 103, and that matches what I have on my i 6.1 system. But the field is 4 characters long, and you are defining it as 3 long. If you only want 3 characters, you need to move your starting position over to 104.   If you start at 103 and use a 4 character field, you will also need to check for one more blank.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    ...it looks like the spool file number is located at 113 . 3    @Phil: Did you check on your system? I can check on V5R3 if needed. The OP originally 114 for 3, so maybe it's a spooled file variation. OTOH, the OP also wasn't getting correct values for SPNO.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    No .. I tried to get it from the op discussion listing but it could well be off by a space.
    50,860 pointsBadges:
    report
  • philpl1jb
    right  spool file number in 103 - 4 long
    50,860 pointsBadges:
    report
  • 6r
    Even this is not working not a single spool file is being deleted: New (My file4)LF:- 0001.00 R REC1 PFILE(JKJK1/N12) 0002.00 FILE I SST(N12 1 10) 0003.00 USER I SST(N12 13 8) 0003.01 SPNO I SST(N12 103 4) 0003.02 JOB I SST(N12 108 10) 0003.03 JNO I SST(N12 119 6) 0004.00 STS I SST(N12 46 3) New Modified progrm:- PGM DCLF FILE(JKJK1/MYFILE4) READ: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND(%SST(&SPNO 1 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 1 1)) VALUE('0')) IF COND(%SST(&SPNO 2 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 2 1)) VALUE('0')) IF COND(%SST(&SPNO 3 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 3 1)) VALUE('0')) IF COND(&USER *EQ JKJK *AND (&STS *EQ HLD *OR + &STS *EQ RDY)) THEN(DO) DLTSPLF FILE(&FILE) JOB(&JNO/&USER/&JOB) SPLNBR(&SPNO) MONMSG MSGID(CPF0000) ENDDO GOTO CMDLBL(READ) When I call this program and check using wrksplf command before and after of running this program ,ican't see any differences in spool files they reamin as it is.
    1,590 pointsBadges:
    report
  • philpl1jb
    So you think the logical file is now providing the data .. then IF COND(&USER *EQ JKJK *AND (&STS *EQ HLD *OR +&STS *EQ RDY)) THEN(DO) I think JKJK should be 'JKJK' and HLD 'HLD' and RDY 'RDY'  
    50,860 pointsBadges:
    report
  • TomLiotta
    When I call this program...   What does debug tell you about values that are found after records are read? The first records should be garbage because they are from the headings of the report. But after reading the first three or four records, it should get into the detail list.   And it should be okay not to have quotes around your constants, but it's also a good idea to use quotes. It helps to show where constants exist in the source.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Problem solving 101.  If it were our problem, we know how to solve it but you need to learn how to solve problems.Debug or look at the job log. Add a message to send the field values to yourself every time you read a record.Are you reading the records?Do you ever issue a DLTSPLF?Send a message with the values when you issue the DLTSPLF. 
    50,860 pointsBadges:
    report
  • TomLiotta
    I used the original code, with minor corrections that have already been mentioned, and it worked. I replaced DLTSPLF with DSPSPLF for testing. I have my thoughts on why it might not be working, but doing a debug exercise is a far better suggestion than simply giving guesses. The alternative of sending messages is also something that I often do during testing, especially if submitting to batch. -- Tom.
    125,585 pointsBadges:
    report
  • 6r
    I have debuggged it many times and can see all the job no,job name user name and spool file name comes correctly after first 2-3 garbage recods but program does not perform dltsplf command,but it does perform when i forcefully assign the job no,jobname,username and spool file name during debug by using EVAL command for example just before the DLTSPLF i set break point and do EVAL &USER='JKJK' &JNO=123456' ,&JOBNAME ='QPAD...' (just for expalining my point n
    1,590 pointsBadges:
    report
  • 6r
    .. So it does performDLTSPLF during debug mode when i forcefully assign those parameters using EVAL command. but it does read all the recods from myfile4 and now spool file numbers are coming correctly after giving the lenghth of 4 to my spool file number field in Myfile4 .But still not sure why this program is not working in desired way.
    1,590 pointsBadges:
    report
  • philpl1jb
    I'm sorry, obviously when you reach the If and DLTSPLF commands one of the file variables values isn't correct.  In Debug you can check all of the values. &JNO  &USER &JOB, &STS, &FILE, or &SPNO aren't current or correct values.  You can check all of these during debug.   
    50,860 pointsBadges:
    report
  • TomLiotta
    The values might be correct and DLTSPLF is failing anyway. E.g., no *SPLCTL or no authority to *ALLOBJ user or various problems. With the MONMSG set for CPF0000, the program has essentially been told to ignore any problems and continue as if nothing went wrong. It might be useful to put some code into the MONMSG to see if it's going through that path. (The check for CPF0000 with no action shouldn't be there anyway.) -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Of course the job log will capture the message is set properly but removing the MONMSG might expose the issue.
    50,860 pointsBadges:
    report
  • 6r
    On very carefully seeing file name was incorrect it was having one extra leading blank in &SFILE. Thats why it was not deleting the spool file.Thanks for pinpointing the possible errors. Now the corrected DDS of logical file Myfile 4 is as following:- 0001.00 R REC1 PFILE(JKJK1/N12) 0002.00 FILE I SST(N12 2 10) 0003.00 USER I SST(N12 13 8) 0003.01 SPNO I SST(N12 103 4) 0003.02 JOB I SST(N12 108 10) 0003.03 JNO I SST(N12 119 6) 0004.00 STS I SST(N12 46 3) and I have made some more modifications in my previous program CSPOOL -for deleting the spool files for specific user JKJK in order to avoid manually issuing CPYSPLF command from the output of QORTSPLF(which comes as a output of fWRKSPLF).Now this program is deleting all the spool files for user JKJK except the followingones:- Device or Total Cur Opt File User Queue User Data Sts Pages Page Copy QPRTSPLF JKJK JKJK RDY 1 1 QPJOBLOG JKJK QEZJOBLOG MYJOB8 RDY 4 1 I think this should be fine since qprtsplf is getting created because of WRKSPLF command in my modified program and QPJOBLOG seems nothing more than job log of my submiited job in QBATCH to call this modified program. However I have question here that why this program is not being successfully being called from comand line.IF i directly call using C against program name than 1) due to WRKSPLF command screen comes displaying all the spool files. 2) Then after that if i press enter than following error appears:- Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. Job 548715/JKJK/QPADEV00DN changed by JOBMANAGER. CPF3303 received by procedure CSPOOL1. (C D I R) Type reply, press Enter. Reply . . . F3=Exit F12=Cancel 3) If I press F1 on CPF3303 received by procedure CSPOOL1. (C D I R) to know the reason behind this message than:- following detailed screen appears:- Message ID . . . . . . : CPA0702 Severity . . . . . . . : 99 Message type . . . . . : Inquiry Date sent . . . . . . : 12/16/12 Time sent . . . . . . : 10:58:43 Message . . . . : CPF3303 received by procedure CSPOOL1. (C D I R) Cause . . . . . : ILE Control language (CL) procedure CSPOOL1 in module CSPOOL1 in program CSPOOL1 in library JKJK1 detected an error at statement number 0000000102. Message text for CPF3303 is: File QPRTSPLF not found in job 548715/JKJK/QPADEV00DN. Use F10 (if available) or the Display Job Log (DSPJOBLOG) command to see the messages in the job log for a more complete description of what caused the error. If you still are unable to solve the problem, please contact your technical support person. Recovery . . . : This inquiry message can be avoided by changing the procedure. Monitor for the error (MONMSG command) and perform error recovery within the procedure. To continue, choose a reply value. Possible choices for replying to message . . . . . . . . . . . . . . . : More... Press Enter to continue. Message ID . . . . . . : CPA0702 Severity . . . . . . . : 99 Message type . . . . . : Inquiry C -- Cancel the CL procedure. D -- Dump the CL procedure variables and cancel the procedure. I -- Ignore the failing command. R -- Try the failing command again. Bottom Press Enter to continue. F3=Exit F6=Print F9=Display message details F10=Display messages in job log F12=Cancel F21=Select assistance level F3=Exit F6=Print F9=Display message details F10=Display messages in job log F12=Cancel F21=Select assistance level it seems here prgram not detecting QPRTSPLF the same program recognize QPRTSPLF if i submit it using CALL PGM(CSPOOL1) in SBMJOB command than job not only gets sumbitted successfully but also gets completed normally. Not sure what causes this behaviour of CL program. However I tried giving all the 4 options C,D,I,R one by one by calling the same CSPOOL1 program from command line but it doesnot work.It does work properly as said if i submit it in job using call pgm(cpspool1). 4) I have one more question here like if i need to delete the spool files of some other user along with JKJK (let's say another user is 'ABC' Then will the followinf if condition will be correct? IF COND(&USER *EQ JKJK *AND &USER *EQ ABC *AND + (&STS *EQ HLD *OR &STS *EQ RDY)) THEN(DO) DLTSPLF FILE(&FILE) JOB(&JNO/&USER/&JOB) SPLNBR(&SPNO) also in my program i am selecting all the spool files using WRKSPLF command then copying those files from QPRTSPLF to N12(Flat file). But in actual if i want only the spool files of only two users as mentioned above 1)JKJK 2) ABC then apart from above mentioned if condition is there any alternative way to achieve that target? My modified program that seems to be working fine for deleting the spool file of single user JKJK :- PGM DCLF FILE(JKJK1/MYFILE4) wrksplf CPYSPLF FILE(QPRTSPLF) TOFILE(N12) READ: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND(%SST(&SPNO 1 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 1 1)) VALUE('0')) IF COND(%SST(&SPNO 2 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 2 1)) VALUE('0')) IF COND(%SST(&SPNO 3 1) *EQ ' ') THEN(CHGVAR + VAR(%SST(&SPNO 3 1)) VALUE('0')) IF COND(&USER *EQ JKJK *AND (&STS *EQ HLD *OR + &STS *EQ RDY)) THEN(DO) DLTSPLF FILE(&FILE) JOB(&JNO/&USER/&JOB) SPLNBR(&SPNO) MONMSG MSGID(CPF0000) ENDDO GOTO CMDLBL(READ) END: ENDPGM Thanks .
    1,590 pointsBadges:
    report
  • TomLiotta
    First, you can check for two users, but you need to check this way:   IF COND( (&USER *EQ JKJK *or &USER *EQ ABC) *AND +(&STS *EQ HLD *OR &STS *EQ RDY)) THEN(DO)   You need the *OR test for &USER, and that test needs its own set of parentheses.   Your WRKSPLF needs to be this way:   WRKSPLF OUTPUT(*PRINT)   The command works in batch because it defaults to *PRINT in batch. It defaults to the display when run interactively, so you need to tell it to print. (There is no display in batch.)   I remember that the spool file name had an extra blank when I ran my test, but forgot to mention it. It's better that you found it on your own, though. It shows that you are learning how to debug and how to find the smallest details. Good job.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Now that your program works, why can't you just run this way:   DLTSPLF FILE(*SELECT) SELECT(JKJK)   Tom
    125,585 pointsBadges:
    report
  • 6r
    I have written this program since i hwanted only those spooled files to be deleted whose status is either HLD OR RLS. and I don’t think without a program this could have been possible. following command will delete all spool files for user JKJK DLTSPLF FILE(*SELECT) SELECT(JKJK) but what if i want to delete only those whose staus is either HLD or RDY. Please correct me if this could also have been done in other way or in other programming approach or through some other logic without creation of Logical file and flat file or even some simpler method. Thanks
    1,590 pointsBadges:
    report
  • TomLiotta
    It's true; DLTSPLF doesn't select by status. My question is related to the number of spooled files that will have status that is not HLD or RDY. Do you have those often? What status do those have? How often will you run your program when spooled files are not HLD or RDY? Why do you have those spooled files? -- Tom
    125,585 pointsBadges:
    report
  • 6r

    one more question in same regard like:-

    This program deletes all the spool file to specfic user  and if we want to add one more condition like 1) delete spool file of specific job and in to this specific user whose status is either HLD or RDY.

    also whats the difference between deleting spooled files along with that specific job

    and manually deleting the spooled files of specific job and specific user which after deleting shows status as 'FIN'.

    where as if we delete them through dltsplf whole job it self along with specific user gets deleted

     

     

    1,590 pointsBadges:
    report
  • TomLiotta

    where as if we delete them through dltsplf whole job it self along with specific user gets deleted

    The "specific user" will never be deleted by running DLTSPLF. The "whole job" will be deleted only if the job has ended and all spooled files are deleted.

    That is the same way it works when manually deleting spooled files. There is no difference in how the two ways work.

    If the job is still active, the list of spooled files for the job will show status 'FIN' for a deleted spooled file. That status will remain until the job ends.

    Tom

    125,585 pointsBadges:
    report
  • 6r
    Thanks a lot.
    1,590 pointsBadges:
    report
  • 6r

    One more thing--> why does that specific job not end even if all the spooled files after deleting manually shows in 'FIN' status.here some times job is ended after deleting all the spooled files under it and some times it keeps showing it's all spooled files as 'FIN' status.

     

    1,590 pointsBadges:
    report
  • 6r

    in what scenarios system behave like this?

     

    1,590 pointsBadges:
    report
  • TomLiotta

    A job doesn't end simply because all spooled files are deleted. But if a job has previously been ended, it will be removed from the system after all spooled output has been deleted. An active job can have all of its spooled files deleted. That doesn't end the job.

    There can be conditions when a system takes excessive time to remove a job. A job might be in an abnormal state and be unable to end. In such a case, only IBM would know what the cause was.

    The most common reason that I see id simply a very large external message queue. It takes time for the system to clear the space and release all resources. That shouldn't take more than a few minutes even on a slow system.

    There is at least one exception. If a job is named QPRTJOB, you should expect it to take at least 24 hours before the system removes it. The system will keep those jobs around in case new spooled files will become attached to them. Those are jobs that are defined to hold "detached" spooled for users.

    Tom

    125,585 pointsBadges:
    report
  • 6r
    So does that mean for deleting the spooled files of QPRTJOB either through manually or through above program which was discussed above will keep the status of all the deleted spooled files as 'FIN' from the moment of deleting them up to next 24 hours and then this QPRTJOB will disappear and  New QPRTJOB will enter in the system that will start keeping fresh 'HLD' 'RDY' spooled files in it and old spooled files which have been deleted from tthis QPRTJOB after 24 hours will they be shown as 'FIN' ?
    1,590 pointsBadges:
    report
  • 6r

    ...along with new job number and with same specific user and same job(QPRTJOB).

    So after 24 hours (the exception job) QPRTJOB and  that specific user and a new job number will be generated by the system that will show old ones as  deleted  means in 'FIN'  status and newly attached(after 24hours) status under this (QPRTJOB) either 'HLD' or 'RDY' right?

     

    1,590 pointsBadges:
    report
  • 6r

    So only QPRTJOB is the job  which even after deleting all it's spooled files(up to 24 hours) will be available in system (with same job name(QPRTJOB) AND THAT SPECIFIC USER(WHOSE SPOOLED FILE WE WANT TO DELETE THROUGH PROGRAM AND AS DISCUSSED ABOVE) and with same  job number  will be available just up to 24 hours ever since it's spooled files were and will show deleted spooled files(either manually or prgramatically) as 'FIN' and after 24 hours just job number will be changed and job name (QPRTJOB) Job user name(that specific user) will remain same only new Job number will be introduced by system.So that newly created spooled files either as HLD or RDY could be atached here...right?

     

    Thanks

    1,590 pointsBadges:
    report
  • 6r

    ..Also how does this QPRTJOB enters in the system and for how long does it show old deleted spooled files(either manually or through programatically)  as 'FIN' .

    Accepted that new job enters(only Job number gets changed) in system which keeps spooled files generated in the system either as HLD or RDY but what is the time limit for the old spooled files which have been deleted(manually or programatically) to be shown in 'FIN' status along with newly attached with it(eith HLD or RDY) means how long(days/months/years) will the system show old deleted spooled files in 'FIN' status.?

    Thanks

     

    1,590 pointsBadges:
    report
  • TomLiotta
    Read the QPRTJOB job topic in the Information Center for details. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta

    ...how long(days/months/years) will the system show old deleted spooled files in 'FIN' status.?

    I don't know if that's documented anywhere. I have a few old FIN entries in one QPRTJOB, but there's no way to tell how old those entries are. Once the file is deleted, the attributes of the file are no longer available. I would first guess that old entries might be cleaned up after an IPL, but it will be a while before I can test that.

    If you need an authoritative answer, you might need to call IBM and ask. Otherwise, you might simply watch some entries to see how long they last.

    Why does it matter?

    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