Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
in my sort card, i am using outrec with outfil.
Code:
OUTREC=(X:Y,L)
X = refers to the starting position of output field
Y = refers to the starting position of the corresponding input field
but i am confused about L : is this the length of the input field or output field ?
as in input file if some field like NAME which starts from 10th position and length 12 whereas same field starts at 15th position in the output field but layout shows it has max length of 8 bytes.
then shall i write the outrec as
Code:
OUTREC=(15:10,12) OR OUTREC=(15:10,8)
Also what in case if i want to put spaces or zeros at BRANCH-NO field having S9(9) COMP-3 starting at 10th position & length 5 bytes in the output file ?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
L : is this the length of the input field or output field ?
Yes.
L refers to the input length but for X:Y,L it will also be used as the output length, so if you want a different output length then the input length, you need to truncate or pad accordingly. For something like X:Y,L,F,TO=ZD,LENGTH=N, L is the input length and N is the output length.
Quote:
as in input file if some field like NAME which starts from 10th position and length 12 whereas same field starts at 15th position in the output field but layout shows it has max length of 8 bytes.
Code:
OUTREC=(15:10,12)
will put input positions 10-21 in output positions 15-26.
Code:
OUTREC=(15:10,8)
will put input positions 10-17 in output positions 15-22.
10:5X would give you spaces in output positions 10-14.
10:5Z would give you binary zeros in output positions 10-14.
10:X'000000000C' would give you a PD 0 in positions 10-14
10:+0,TO=PD,LENGTH=5 would also give you a PD 0 in positions 10-14.
Temporarily i have kept zeros at 41st position in the output file for length zeros, now similar problem occured while copying from 445th position [S9(13)V99 COMP-3] into the 46th position in the output having S9(13) COMP-3.
Help needs in both the scenarios:
1. copying from 9(8) to S9(9) COMP-3 field
2. copying from S9(13)V99 COMP-3 to S9(13) COMP-3.
[/code]
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
OK. In the example Frank used, a literal became a packed decimal. Now you want "something" to become packed decimal, but DFSORT needs to know what the "something" is to start with, and if it is numbers, presumably it is Zoned Decimal.
If you try
Code:
41:105,8,ZD,TO=PD,LENGTH=5
then DFSORT will know what it is turning into a packed field, so it will be able to do it.