|
View previous topic :: View next topic
|
| Author |
Message |
ram_vizag
Active User
Joined: 21 Aug 2008 Posts: 112 Location: hyd
|
|
|
|
Hi,
Please explain about what outrec is doing in below code:
| Code: |
SORT FIELDS=(47,29,CH,A,
1,42,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1:1,185,X'00000001',
190:190,260)
END
|
The input rec is having record length of 449.
Is that outrec does ' to place 4 from 185th field. and from 190 to 260 what will happen???? |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
| What results did you get when you tried it ? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Code: |
OUTREC FIELDS=(1:1,185,X'00000001',
190:190,260) |
There is some silliness here.
Firstly, BUILD should be preferred to FIELDS. FIELDS means different things in different places, BUILD only means one thing, so less confusing.
For BUILD (and FIELDS) the default starting position is byte 1. So no need for "1:". 189 bytes are then placed in the output record area, so no need for "190:" either. By including column numbers where they are not needed, clarity is lost and maintenance made more difficult.
Without the OUTREC, the output record would consist of the data 1 for a length of 439.
What the OUTREC is doing is copying 185 bytes from position 1, 260 bytes from position 190, and blatting four bytes to binary one starting at 186.
It should be noted that OUTREC runs after the SUM, so you may now end up with records which are identical but for which duplicates would have been dropped if INREC was used instead of OUTREC.
The code should be
| Code: |
| OVERLAY=(186:X'00000001') |
It should be on INREC if you want the SUM to take account of it, else on OUTREC. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|