View previous topic :: View next topic
|
Author |
Message |
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Or I suppose, a simple REXX to read the file and issue an IDCAMS DELETE on each record that it finds. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
but ...
if the file names follow some patterns
DFDSS might certainly be a better way
extraordinary filtering capabilities |
|
Back to top |
|
|
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
David Robinson
Active User
Joined: 21 Dec 2011 Posts: 199 Location: UK
|
|
|
|
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 |
|
|
Ramsee
New User
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
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 |
|
|
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
Hi Marso/Ramsee
Thanks a lot . It worked.
Thanks everyone in the forun for your valuable suggestion. |
|
Back to top |
|
|
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
|