Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copy 4 byte of data from the last record of a dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Copy 4 byte of data from the last record of a dataset
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: 1932
Location: UK

PostPosted: Fri Oct 06, 2017 3:04 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1827
Location: NY,USA

PostPosted: Fri Oct 06, 2017 7:57 pm    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1827
Location: NY,USA

PostPosted: Fri Oct 06, 2017 11:01 pm    Post subject:
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    Post subject:
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: 1932
Location: UK

PostPosted: Mon Oct 09, 2017 2:30 pm    Post subject:
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    Post subject:
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: 2445
Location: Netherlands, Amstelveen

PostPosted: Mon Oct 09, 2017 8:04 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1827
Location: NY,USA

PostPosted: Mon Oct 09, 2017 8:38 pm    Post subject:
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    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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 1 Thu Dec 14, 2017 5:46 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us