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

Replace a DATE in Line-2/ Column 160 to 167 in VB


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshkareti

New User


Joined: 22 Jul 2008
Posts: 33
Location: Chennai

PostPosted: Mon Mar 30, 2015 2:01 pm
Reply with quote

I have a VB file and I need to replace a DATE string in the 2nd line at 160 to 167 positions.
The DATE in this position will always change and I just need to replace the this date from the date in another file..

File-1
Code:

header1234
abcdefgh10102014qwerty
trailer1234


File-2
Code:

05052015


the date in file-1 in line-2 .. position 9 (10102014) has to be replaced by 05052015.
This is just example, but ideally the date in file-1 will not be known and i just have to replace position 9-16 with 05052015 only in line-2. This date change should happen only in Line-2 in my requirement.

Pleas help with a SORT step to achieve this

Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Mar 30, 2015 2:54 pm
Reply with quote

Two-step process.

First, you take your date file and generate a sort symbol/SYMNAME from it. Be aware that the file where you generate the symbol must have fixed-length 80-byte records, so end your BUILD with 80:X) is a good way to do that.

Second, extend your variable-length records, after the RDW, to include enough space for a sequence number which is big enough for the number of records your file can contain. Put a sequence number there. When the sequence number is two, do an OVERLAY to put the date symbol in the position you requiure.

Ensure that your records are then restored to their original size without the extension.
Back to top
View user's profile Send private message
rinsio

New User


Joined: 16 Feb 2015
Posts: 13
Location: Madrid, Spain

PostPosted: Mon Mar 30, 2015 3:51 pm
Reply with quote

Hello nareshkareti
There is another option but you shuld give us more detalis. For example

is the detail record identified? I think a solution thinking about the types of record have identifications. I simulate FB file. You could make the changes you need.

Code:
000015 //PASO001 EXEC PGM=SORT,COND=(0,NE)                             
000016 //SYSOUT   DD SYSOUT=*                                           
000017 //SORTIN   DD *                                                 
000018 05052014                                                         
000019 /*                                                               
000020 //SORTOUT  DD DSN=DESXXX.MAINFR.SALIDA,                         
000021 //            DISP=(,CATLG,DELETE),                             
000022 //            SPACE=(TRK,(10,10),RLSE),                         
000023 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)         
000024 //SYSIN   DD *                                                   
000025   SORT FIELDS=COPY                                               
000026   OUTREC FIELDS=(3X,C'OVERLAY=(9:C',X'7D',1,08,X'7D',           
000027                  C'))',53X)                                     
000028 /*                                                               
000029 //***********                                                   
000030 //PASO002 EXEC PGM=SORT,COND=(0,NE)                             
000031 //SYSOUT   DD SYSOUT=*                                           
000032 //SORTIN   DD *                                                 
000033 HEADER1234                                                     
000034 ABCDEFGH10102014QUERTY                                         
000035 TRAILER1234                                                   
000036 /*                                                             
000037 //SORTOUT  DD DSN=DESXXX.MAINFR.SALIDA1,                       
000038 //            DISP=(,CATLG,DELETE),                           
000039 //            SPACE=(TRK,(10,10),RLSE),                       
000040 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)       
000041 //SYSIN    DD *                                               
000042     SORT  FIELDS=COPY                                         
000043   OUTFIL FNAMES=SORTOUT,                                       
000044     IFTHEN=(WHEN=(01,1,CH,EQ,C'A'),                           
000045 //         DD DSN=DESRIB.MAINFR.SALIDA,DISP=SHR           


Code:
OUTPUT FILE
 BROWSE    DESXXX.MAINFR.SALIDA1                      Line 00000000 Col 001 080
 Command ===>                                                  Scroll ===> CSR
********************************* Top of Data *********************************
HEADER1234                                                                     
ABCDEFGH05052014QUERTY                                                         
TRAILER1234                                                                   
******************************** Bottom of Data *******************************


Best regards

Code'd
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top