Page 1 of 1

Replace a small integer value in a record

PostPosted: Fri Mar 27, 2015 10:14 pm
by johndutcher
I am so close to having a need to update two small integer fields in a file with the code below......but both overlays place the 'result' of the addition into columns 1 and 2 of
the records instead of the columns expected (56,57 and 33,34) ....Does anyone see why ?

//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(56,2,BI,EQ,14),
OVERLAY=(56,2,BI,ADD,+5,TO=BI,LENGTH=2)),
IFTHEN=(WHEN=(33,2,BI,EQ,15),
OVERLAY=(33,2,BI,ADD,+5,TO=BI,LENGTH=2))
/*

Columns 1 and 2 are replaced in the output record ???

Re: Replace a small integer value in a record

PostPosted: Sat Mar 28, 2015 12:08 am
by BillyBoyo
With OVERLAY you have to tell where you want the value to go. The default for fixed-length records is to start at position one, and for variable-length records to start at position five (the first byte of data).

You probably want OVERLAY=(33:33,2,BI,ADD,+4,TO=BI,LENGTH=2) and similar for the other one.

Re: Replace a small integer value in a record

PostPosted: Sat Mar 28, 2015 6:27 pm
by johndutcher
Hi.....YES.....thanks for fast action response......works very well now.
As a long time mainframer.....I am increasingly amazed at what can be accomplished without a line of COBOL code.
What a timesaver !!

Re: Replace a small integer value in a record

PostPosted: Sat Mar 28, 2015 7:48 pm
by BillyBoyo
Me too :-)

As a long time Mainframer, you'd also perhaps prefer the sister site, link second from the right at the bottom of the page. Lots of examples there (and here).

There is extensive documentation available (Getting Started and Application Programming Guide, plus various papers including Smart DFSORT Tricks) at the DFSORT pages on the web.