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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 30, 2008 3:20 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 30, 2008 3:35 pm
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: 459
Location: Belgium

PostPosted: Fri May 30, 2008 3:35 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 30, 2008 3:54 pm
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
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: 459
Location: Belgium

PostPosted: Fri May 30, 2008 4:24 pm
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
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: 459
Location: Belgium

PostPosted: Fri May 30, 2008 4:28 pm
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
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
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 Developer


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

PostPosted: Fri May 30, 2008 9:25 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top