Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Change the first 15 bytes of a record with a new value.

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

New User


Joined: 30 May 2008
Posts: 9
Location: hyderabad

PostPosted: Fri May 30, 2008 3:00 pm    Post subject: Duplicating a record & changing first 15 bytes
Reply with quote

Can you please let me know the JCL step which will take the input as below and output will have the same records and a duplicate of that particular record which has the value as 004454211 in the first 15 bytes.



That is whenever first 15 bytes are ‘004454211 ‘ then this should be replaced with ‘037518412D72 ‘, but the old record should also be present in the file.



I/p PS file:


004454211 81002008041020080410QYQY009331497
004454211 810101 000000005D000000005DEA00000

output should be like below when first 15 bytes in the record are '004454211 '

004454211 81002008041020080410QYQY009331497
004454211 810101 000000005D000000005DEA00000
037518412D72 81002008041020080410QYQY009331497
037518412D72 810101 000000005D000000005DEA00000
Back to top
View user's profile Send private message

mohd Waseem Ahmed

New User


Joined: 30 May 2008
Posts: 9
Location: hyderabad

PostPosted: Fri May 30, 2008 3:13 pm    Post subject: Change the first 15 bytes of a record with a new value.
Reply with quote

Can you please let me know the JCL step which will take the input as below and output will have the first 15 bytes changed to '037518412D72 ' .
That is whenever first 15 bytes are ‘004454211 ‘ then this should be changed to ‘037518412D72 ‘.

I/P PS file:
004454211 81002008041020080410QYQY009331497
004454211 810101 000000005D000000005DEA00000

Output file:
037518412D72 81002008041020080410QYQY009331497
037518412D72 810101 000000005D000000005DEA00000
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri May 30, 2008 3:20 pm    Post subject: Reply to: Change the first 15 bytes of a record with a new v
Reply with quote

make up your mind,,, do You want to duplicate or only change...
how do You expect an answer if You keep changing Your questions


when posting data use the code tag to preserve the blnks and record layout

here is a snippet ( not tested ) that might give You an hint on how to proceed

Code:
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC  IFTHEN=(WHEN=(1,15,CH,EQ,C'123456789012345'),
      OVERLAY=(1:C'123456789012345'))
/*
Back to top
View user's profile Send private message
mohd Waseem Ahmed

New User


Joined: 30 May 2008
Posts: 9
Location: hyderabad

PostPosted: Fri May 30, 2008 3:29 pm    Post subject: Reply to: Change the first 15 bytes of a record with a new v
Reply with quote

I am extreamly sorry, but i need this to be done urgently, thats y what i did was that i have copied all the records with first 15 bytes as <004454211 > into a new file, So my present requirement will be to change the all the records with first 15 bytes to a new value,
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri May 30, 2008 3:35 pm    Post subject: Reply to: Change the first 15 bytes of a record with a new v
Reply with quote

Quote:
but i need this to be done urgently


for urgencies never rely on forums
replying is on voluntary basis, time availability and at no charge
and the posting style must make people willing to answer,
posting repeatedly, changing mind, claiming urgency,
well... are just things that do not encourage

if You want something done quickly, according to Your specs and out of the box
You/Your_organization should be prepared to pay for it
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Fri May 30, 2008 3:35 pm    Post subject:
Reply with quote

Can you edit the file in ISPF and pass command Change
Back to top
View user's profile Send private message
mohd Waseem Ahmed

New User


Joined: 30 May 2008
Posts: 9
Location: hyderabad

PostPosted: Fri May 30, 2008 3:49 pm    Post subject:
Reply with quote

Can somebody please help me on this, only if they have time i take my words back that it is urgent... I shudnt be using that
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri May 30, 2008 3:54 pm    Post subject: Reply to: Change the first 15 bytes of a record with a new v
Reply with quote

try the snippet I posted, it should work
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Fri May 30, 2008 4:23 pm    Post subject:
Reply with quote

You can achieve this through the below jcl. I have used SORT in three steps to do this but this can be simplified i believe.

Code:

//SSORT    EXEC  PGM=SORT                           
//SORTIN   DD  DSN=USERID.SORTIN,DISP=SHR           
//SORTOUT  DD  DSN=USERID.SORTTEMP,DISP=SHR         
//SYSOUT   DD  SYSOUT=*                             
//SORTMSG  DD  SYSOUT=*                             
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
//*                                                 
/*                                                   
//SSORT1   EXEC  PGM=SORT                           
//SORTIN   DD DSN=USERID.SORTTEMP,DISP=SHR         
//SORTOUT  DD  DSN=USERID.SORTTEMP,DISP=SHR         
//SYSOUT   DD  SYSOUT=*                             
//SORTMSG  DD  SYSOUT=*                             
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  INREC   IFTHEN=(WHEN=(1,10,CH,EQ,C'004454211 '),   
         BUILD=(C'037518412D72 ',11,67))             
//*                                               
/*                                                 
//SSORT2   EXEC  PGM=SORT                         
//SORTIN   DD DSN=USERID.SORTIN,DISP=SHR         
//         DD DSN=USERID.SORTTEMP,DISP=SHR       
//SORTOUT  DD  DSN=USERID.SORTOUT,DISP=SHR       
//SYSOUT   DD  SYSOUT=*                           
//SORTMSG  DD  SYSOUT=*                           
//SYSIN    DD *                                   
  SORT FIELDS=(1,80,CH,A)                         
  SUM FIELDS=NONE                                 
//*       
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Fri May 30, 2008 4:24 pm    Post subject:
Reply with quote

and make a save before
Back to top
View user's profile Send private message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Fri May 30, 2008 4:24 pm    Post subject: Reply to: Change the first 15 bytes of a record with a new v
Reply with quote

//S0000001 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
004454211 81002008041020080410QYQY009331497
004454211 810101000000005D000000005DEA00000
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,15,CH,EQ,C'004454211 '),
OVERLAY=(1:C'037518412D72 '))
/*

output comes as :-
037518412D72 81002008041020080410QYQY009331497
037518412D72 810101000000005D000000005DEA00000

try the above JCL I had tried it works.... icon_biggrin.gif
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Fri May 30, 2008 4:28 pm    Post subject:
Reply with quote

Please clarify also this
"004454211" does not make a length of 15.

Is it more "replace with shift" than just "replace" ?

If it is urgent, give us all the information and clear information.

Again can you Edit the file?
Back to top
View user's profile Send private message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Fri May 30, 2008 4:36 pm    Post subject:
Reply with quote

Yes !! PeD you are correct!!,

I had assumed and taken
(004454211 with blanks ) = 15 bytes

and had replaced
(037518412D72 with blanks) = 15 bytes

Everytime posting an issue should clarify things at one shot
which will help and enthusize others for quick and accurate reply
Back to top
View user's profile Send private message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Fri May 30, 2008 4:41 pm    Post subject:
Reply with quote

//S0000001 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
004454211 81002008041020080410QYQY009331497
004454211 810101000000005D000000005DEA00000
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,15,CH,EQ,C'004454211 '),
OVERLAY=(1:C'037518412D72 '))
/*

output comes as :-
037518412D72 81002008041020080410QYQY009331497
037518412D72 810101000000005D000000005DEA00000
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 30, 2008 9:25 pm    Post subject:
Reply with quote

mohd,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN                                 
//SYSOUT    DD  SYSOUT=*                                 
//SORTIN DD *                                             
004454211        81002008041020080410QYQY009331497       
004454211        810101 000000005D000000005DEA00000       
//SORTOUT DD SYSOUT=*                                     
//SYSIN    DD    *                                       
  OPTION COPY                                             
  INREC IFTHEN=(WHEN=(1,15,CH,EQ,C'004454211'),           
    OVERLAY=(1:C'037518412D72',3X))                         
/*


For the WHEN operand, the constant will be padded on the right with blanks to the length of the field (15 characters). For the OVERLAY operand, we use 3X to pad the constant with blanks on the right to 15 characters.
Back to top
View user's profile Send private message
mohd Waseem Ahmed

New User


Joined: 30 May 2008
Posts: 9
Location: hyderabad

PostPosted: Mon Jun 02, 2008 12:40 pm    Post subject: Its working
Reply with quote

Hi PED,Varun and enrico-sorichetti thanks a lot for your help, I am sorry i did not post the correct file, but
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us