IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy 4 byte of data from the last record of a dataset


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Fri Oct 06, 2017 12:15 pm
Reply with quote

Hey Team,

I need to copy 4 byte of data from the last record of a dataset. For the same I found a ICETOOL code to get last record but I am unable to get the 4bytes from 10th column.

Code:
//S1   EXEC  PGM=ICETOOL                                     
 //TOOLMSG   DD  SYSOUT=*                                     
 //DFSMSG    DD  SYSOUT=*                                     
 //SORTIN DD *                                               
 REC1 abce1234                                                         
 REC2 abcd1231                                                         
 REC3 abcc1232                                                       
 REC4 abcb1233                                                         
 REC5 acbb1244                                                         
 //SORTOUT DD SYSOUT=*                                       
 //TOOLIN DD *                                               
  SELECT FROM(SORTIN) TO(SORTOUT) LAST ON(81,1,CH) USING(CTL1)
 /*                                                           
 //CTL1CNTL DD *                                             
  INREC OVERLAY(81:C'1')
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Oct 06, 2017 3:04 pm
Reply with quote

Nothing to do with JCL & VSAM. All to do with ICETOOL. Moved.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Oct 06, 2017 7:57 pm
Reply with quote

Try this ( first 4 bytes)..
Code:
//SYSIN    DD *                           
   SORT FIELDS=COPY                       
   OUTFIL REMOVECC,NODETAIL,TRAILER1=(1,4)
Back to top
View user's profile Send private message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Fri Oct 06, 2017 10:08 pm
Reply with quote

Hey Rohit thanks for the response...!!!

Below code worked for me...
Code:

//S1 EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SIN1  DD DSN=dataset1,
//SORTOUT DD DSN= .... ,
//TOOLIN DD *
   SUBSET FROM(SIN1) TO(SORTOUT) KEEP INPUT LAST USING(CTL1)
/*
//CTL1CNTL  DD *
   INREC BUILD=(8,4)
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Oct 06, 2017 11:01 pm
Reply with quote

Glad , You found out a way by yourself!!
Back to top
View user's profile Send private message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Mon Oct 09, 2017 9:26 am
Reply with quote

Hi Team

For the same job I am not able to get the data from more than one dataset into one. I am getting only the data present in last dataset provided in SIN2. Please have a look to below code and let me know what went wrong:-

Code:
//S1     EXEC PGM=ICETOOL                                     
//TOOLMSG DD SYSOUT=*                                         
//DFSMSG  DD SYSOUT=*                                         
//SIN1    DD DSN=ABCD.EFGH(0),                     
//           DISP=SHR                                         
//SIN2    DD DSN=ABCD.IJKL(0),                 
//           DISP=SHR                                         
//TEMPF   DD DSN=&&TEMPF,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//SORTOUT DD DSN=G7UST.JOB.FILE.SEQNO.OUT,                     
//           DISP=(NEW,CATLG,DELETE),                         
//           DATACLAS=STANDARD,                               
//           DCB=(DSORG=PS,RECFM=FB)                           
//TOOLIN  DD *                                                 
  SUBSET FROM(SIN1) TO(TEMPF) KEEP INPUT LAST USING(CTL1)     
  SUBSET FROM(SIN2) TO(TEMPF) KEEP INPUT LAST USING(CTL2)     
  SORT FROM(TEMPF) TO(SORTOUT) USING(CTL3)                     
/*                                                             
//CTL1CNTL DD *                                               
  INREC BUILD=(8,4)   
//CTL2CNTL DD *           
  INREC BUILD=(8,4)       
//CTL3CNTL DD *           
  SORT FIELDS=(1,80,CH,A)     
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Oct 09, 2017 2:30 pm
Reply with quote

Pre-allocate your output dataset and write to it with a DISP of MOD.
Back to top
View user's profile Send private message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Mon Oct 09, 2017 4:07 pm
Reply with quote

Thnaks Nic it works. But If there no option of pre-allocation of dataset.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Oct 09, 2017 8:04 pm
Reply with quote

Allocation with a DISP=(MOD...) in the same step is not working?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Oct 09, 2017 8:38 pm
Reply with quote

Quote:
For the same job I am not able to get the data from more than one dataset into one. I am getting only the data present in last dataset provided in SIN2. Please have a look to below code and let me know what went wrong:-
I just ran it and it worked. Of course, You are referring to wrong data sets in the output when you checking it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top