Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem while trying to manipulate records using SORT

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

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Tue Jun 30, 2020 1:19 pm    Post subject: Problem while trying to manipulate records using SORT
Reply with quote

Hi Friends
I have a requirement to create a big sequential file of around 10000 records with one of the HEX field incrementing at position 57. I tried SORT to achieve this but I am not getting the desired results.

Could you please help ?

I am trying to change the field at 55th position to insert a number x'0000000102052f' with an increment of 1 whenever the first 3 bytes are not x'00000f'.

Please suggest.

Code:

//STEP001 EXEC PGM=SORT                                                 
//SORTIN   DD DSN=DTD.TEST.DATASET1,DISP=SHR                           
//SORTOUT  DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
 OPTION COPY                                                           -
 INREC IFTHEN=(WHEN=(1,3,PD,NE,X'00000F'))                             -
 OVERLAY=(57:SEQNUM,16,PD,START=X'00000001020052F',INCR=1)             
/*                                                                     
[/code]
Back to top
View user's profile Send private message

Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 277
Location: Bamberg, Germany

PostPosted: Tue Jun 30, 2020 4:49 pm    Post subject:
Reply with quote

Sample (change offsets and lengths to your needs):
Code:
//INCR     EXEC PGM=ICEMAN       
//SORTIN   DD *                                 
ABC                                             
DEF                                             
/*                                             
//SORTOUT  DD SYSOUT=*                         
//SYSOUT   DD SYSOUT=*                         
//SYSIN    DD *                                 
 OPTION COPY                                   
 INREC IFTHEN=(WHEN=(1,3,BI,NE,X'00000F'),     
   OVERLAY=(50:SEQNUM,16,PD,START=1020052,     
            50:50,16,PD,TO=PDF))
* OUTFIL BUILD=(1:1,3,HEX,X,50,16,HEX)           
  END               
/*

Output:
Code:
****** **************************** Datenanfang ************************
000001 ABC                                                             
       CCC44444444444444444444444444444444444444444444440000000000001202
       1230000000000000000000000000000000000000000000000000000000000005F
------------------------------------------------------------------------
000002 DEF                                                             
       CCC44444444444444444444444444444444444444444444440000000000001203
       4560000000000000000000000000000000000000000000000000000000000005F
------------------------------------------------------------------------
****** **************************** Datenende **************************
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Tue Jun 30, 2020 6:56 pm    Post subject: Re: Problem while trying to manipulate records using SORT
Reply with quote

amitc23 wrote:

I am trying to change the field at 55th position to insert a number x'0000000102052f' with an increment of 1 whenever the first 3 bytes are not x'00000f'.

Please suggest.

Code:

//STEP001 EXEC PGM=SORT                                                 
//SORTIN   DD DSN=DTD.TEST.DATASET1,DISP=SHR                           
//SORTOUT  DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
 OPTION COPY                                                           -
 INREC IFTHEN=(WHEN=(1,3,PD,NE,X'00000F'))                             -
 OVERLAY=(57:SEQNUM,16,PD,START=X'00000001020052F',INCR=1)             
/*                                                                     
[/code]

I don't see 55 but 57. What is that value 0- unsigned?
Back to top
View user's profile Send private message
amitc23

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Thu Jul 02, 2020 10:41 pm    Post subject: Reply to: Problem while trying to manipulate records using SORT
Reply with quote

Thanks Joerg and Rohit. Checked the post today only. I wrote a small one time cobol program to achieve this. However will try this again when I get some time.
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 Problem getting record length of a re... amitc23 COBOL Programming 2 Thu Jul 02, 2020 10:52 pm
No new posts Need to select all records belonging ... Q5P418 DB2 2 Mon Jun 22, 2020 11:34 pm
No new posts How to filter out certain records bas... manugeorge2004 JCL & VSAM 5 Wed Jun 17, 2020 10:05 pm
No new posts Need to delete inactive records from ... Sanchayita Sinha DB2 5 Fri May 29, 2020 10:47 pm
No new posts Need SQL for two latest records havin... Q5P418 DB2 10 Sun May 10, 2020 8:24 am

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