Posted: Thu Sep 17, 2009 5:21 am Post subject: Copy only last record
I have one iput file but I dont know how many records it contain. I just want to copy the last record into another file. Please let me know if there is any simple solution _________________ Thanks
Madhu Sudhan
Are you a DFSORT user? If yes, With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use SUBSET to do this...:
so to answer your question
Quote:
Is this possible through DFSORT.
yes, you can achieve this with DFSORT but you need to have the respective PTF to use the posted JCL there.
The messages you post tells that your shop does not have that PTF installed. You may ask your system programmers to install that, it's free. _________________ Regards,
Anuj
Last edited by Anuj Dhawan on Thu Sep 17, 2009 11:23 pm; edited 1 time in total
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Sep 17, 2009 2:47 pm Post subject:
psmadhusudhan,
If your intention is to copy just the last record then it is very simple with subset , but since you dont have the latest ptf installed here is another solution
Anuj Dhawan, max length that a TRAILER can take is only 255.
Extarct from Quick Ref
Code:
For a TRAILER1, the field(s) will be extracted from the last record in a file; for a TRAILER2, the field(s) will be extracted from the last record on a page; for a TRAILER3, the field(s) will be extracted from the last record in a section. p is the starting position of the field in the record; [b]l is the length in bytes (1-255) [/b]of the field. Any number of fields can be specified. (Contiguous fields within a record may be specified with a single p, l entry, but their combined length may not exceed 255 bytes.) The specified field(s) should be a character or alphanumeric string, or a number in printable format, and the field cannot be converted or edited.
_________________ Cheers
Sivaraj S
'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
kolusu,
I have tried your solution it is working. Thank you very much.
Out of curiosity I have one question, How to copy all records except last reord, even in this case I dont know no of records in input file. Please dont mind in replying if you know the solution. _________________ Thanks
Madhu Sudhan
You're asking a lot of questions in a single thread. You could start a new thread for that.
Well, 'gain with z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use SUBSET to do this:
Code:
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INDD DD DSN= INPUT FILE
//OUTDD DD DISP=OUTPUT FILE
//TOOLIN DD *
SUBSET FROM (INDD) TO (OUTDD) REMOVE INPUT LAST
/*
But as you say that's not availabe at your shop -- you can use the technique described in the "Keep or remove the first and/or last records
" Smart DFSORT Trick at: www.ibm.com/systems/support/storage/software/sort/mvs/tricks/ _________________ Regards,
Anuj
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum