Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort JCL to read PS files from file and delete them

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Wed Aug 27, 2014 7:09 pm    Post subject: Sort JCL to read PS files from file and delete them
Reply with quote

Hi All

Scenerio is that there is a Rexx routine executed in a job which is dynamically creating PS files(PS File names are written in some PS file say X and count is different every time) and then those files are FTPed to server.

My requirement is to read that file X as input and delete the PS files written in file X after FTP is successful.

Note : PS file X (132 length) contains the file name to be deleted say (UDGB005.PEK0001L.DAT) at position 4 till 23 .

Can anyone help on this or let me know the approach to accomplish this.

Let me know if I am not clear.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 27, 2014 7:16 pm    Post subject:
Reply with quote

Can you not specify in FTP to delete the file on completion of transfer ?
If you can, I suggest a backup is taken of all of the files before transfer.

You can search the DFSORT forum for other ways to do this, as I recall a situation where IEBCOPY control statements were required from a PS input file. So you could adapt the code to create IDCAMS DELETE statements.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Wed Aug 27, 2014 7:58 pm    Post subject: Reply to: Sort JCL to read PS files from file and delete th
Reply with quote

If I understood correctly, this should put you on the right track:
Code:
//STEP03   EXEC PGM=SORT                             
//SORTIN   DD   DISP=SHR,DSN=your.X.file
//SORTOUT  DD   DISP=(NEW,PASS,DELETE),DSN=&DELLIST 
//SYSIN    DD   *                                   
  SORT     FIELDS=COPY                               
  OUTREC   BUILD=(C' DELETE ',4,20,C' NONVSAM')     
//SYSOUT   DD   SYSOUT=*                             
//***************************************************
//STEP04   EXEC PGM=IDCAMS                           
//SYSPRINT DD   SYSOUT=*                             
//SYSIN    DD   DISP=(OLD,DELETE,DELETE),DSN=&DELLIST

(JCL not tested with an input file having a lrecl of 132)
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 27, 2014 8:14 pm    Post subject:
Reply with quote

Or I suppose, a simple REXX to read the file and issue an IDCAMS DELETE on each record that it finds.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Aug 27, 2014 8:26 pm    Post subject: Reply to: Sort JCL to read PS files from file and delete th
Reply with quote

but ...
if the file names follow some patterns
DFDSS might certainly be a better way
extraordinary filtering capabilities
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Thu Aug 28, 2014 12:47 pm    Post subject: Reply to: Sort JCL to read PS files from file and delete th
Reply with quote

Hi Marso

I tried with your code but its giving below error message. I am trying to resolve this.

ICE805I 1 JOBNAME: TDJA111P , STEPNAME: STEP03
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 08:54 ON
SORT FIELDS=COPY
Å
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTREC BUILD=(C' DELETE ',4,20,C' NONVSAM')
Å
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT
ICE751I 0 C5-K76982 C6-K90026 E7-K95469
ICE052I 3 END OF DFSORT

What i think is your code in step03 is appending 'DELETE and the PS files from 4 to 20' and writing in to temp DS DELLIST.

And in step04 IDCAMS is used to delete the DS DELLIST.

My ques is does step04 delete the temp dataset DELLIST or the PS files written to that dataset. Pls clarify.

My req is to delete those written PS files in DELLIST from DASD.

Hi Expat

I am new to rexx so I am trying first if this could be performed thru JCL.

Hi Enrico
I am not sure of DFDSS. Can you please explain and how it can be performed.
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Thu Aug 28, 2014 1:56 pm    Post subject:
Reply with quote

I don't think you should have too much trouble resolving the SORT error message. For once, it's about as clear as it could possibly be.

If you don't mind my asking, what have you been working on for the last 7 years since you joined the forum? You don't seem to have much idea about JCL, IDCAMS, SORT, Rexx or DFDSS which are all everyday tools of the trade.
Back to top
View user's profile Send private message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 52
Location: Chennai

PostPosted: Thu Aug 28, 2014 2:56 pm    Post subject:
Reply with quote

Hi puneetvirmani143,

You need to give a SPACE in the COLUMN 1 and just give your X File as an input to the SYSIN for the Code given by Mr. Marso.

Your Query1 : What i think is your code in step03 is appending 'DELETE and the PS files from 4 to 20' and writing in to temp DS DELLIST.

Answer : Yes it is appending to delete the Listed file in the column 4 to 20 in X-File.

Your Query2:
My ques is does step04 delete the temp dataset DELLIST or the PS files written to that dataset. Pls clarify.

Answer : It will delete the DSN Listed in the X-File Col 4 to 20.

Your Query 3:
My req is to delete those written PS files in DELLIST from DASD.

Answer : Yes it does the same.

Hope it helps.
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Thu Aug 28, 2014 5:16 pm    Post subject: Reply to: Sort JCL to read PS files from file and delete th
Reply with quote

Hi Marso/Ramsee

Thanks a lot . It worked.

Thanks everyone in the forun for your valuable suggestion.
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Wed Sep 17, 2014 11:31 pm    Post subject: Reply to: Sort JCL to read PS files from file and delete th
Reply with quote

Hello everyone

Thanks for your support last time.
Sort and Idcams is working fine for deleting the PS files in test environment but in prod job fails because files are in use as its getting FTPd in another job .
My scenerio is job A runs in every 30 min ans has rexx(step1) which is creating files (count different in every run ) and next step2 which is triggering a job B that runs only if rexx(step1) is successful and job B is FTPing files created in job A.

I appended sort and idcams steps in job A after step2 to be executed if RC of step2 is 0.

In prod job A fails in idcams as it was trying to delete the files but it was in use in job B in ftp step.

I am not sure why RC of step2 is not checked .. And job A executed idcams in parallel with ftp step ..

Can anyone please suggest how can I delete files after FTP is successful.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us