Page 1 of 1

INREC

PostPosted: Fri Nov 22, 2013 10:26 pm
by itamar rocha
Hi,
Good afternoon.
Somebody can explain this line below:

INREC FIELDS=(1,12,Z,13,5,X'0C',Z,18,11,8Z,C'?',X'0000',C'?',X'000000',C'?')

Thanks.

Re: INREC

PostPosted: Fri Nov 22, 2013 10:47 pm
by BillyBoyo
INREC FIELDS is better as INREC BUILD

 INREC BUILD=(1,12,
              Z,
              13,5,
              X'0C',
              Z,
              18,11,
              8Z,
              C'?',
              X'0000',
              C'?',
              X'000000',
              C'?')


If arranged like that, you can see the separate "fields".

The "number pairs" (1,12 13,5 etc) are taking data from the input record - position 1, length 12, position 13, length 5. They appear on the record at the next available position, so 1,12 appears at position 1 on the output.

The single Zs are binary zeros. Hex '00'. The 8 in 8Z is a "repetition", so it means 8 bytes of binary zeros.

The C'?' is a character constant, a ? will appear at this position.

The X'0C' is a hexadecimal constant. It either represents zero as a one-byte packed-decimal field, or "12" as a one-byte binary field, or the EBCDIC hex code for Form Feed (FF), or it is a longer binary field in conjunction with the following Z, giving a binary zero - value 192. We can't tell which just from looking at the SORT Control Card.

The X'00... are hexadecimal constants. The first is two bytes of... binary zeros. The second is three bytes of binary zeros.

We can guess that the code was changed by someone who did not know what the Z was, and was not bothered to find out. The X'00..s could be replaced by 2Z and 3Z respectively.

Your output will be: 12 bytes from position one of input; a binary zero; five bytes from position 13 of input; X'0C'; one byte binary zero; 11 bytes from position 18 of input; eight bytes of binary zero; a question mark; two bytes of binary zero; a second question mark; three bytes of binary zero; a final question mark.

You should look all of this up in your documentation and make sure that you understand it all. Don't change the X'00..s without being told to. You can include a comment to describe the card and point out that the X'00.. and Z are doing the same thing (remembering that the repetition is important on the Z to get multiple bytes).

Re: INREC

PostPosted: Mon Nov 25, 2013 3:27 pm
by itamar rocha
Good morning.
Thank you.

Re: INREC

PostPosted: Tue Dec 10, 2013 9:51 pm
by itamar rocha
Hello,
I have a question,
When I use the line below:

inrec(5z,x'1c',z)

5z means bynary zeros, rigtht?

what means x'1c'?

Thanks.

Re: INREC

PostPosted: Wed Dec 11, 2013 12:08 am
by skolusu
itamar rocha wrote:Hello,
I have a question,
When I use the line below:

inrec(5z,x'1c',z)

5z means bynary zeros, rigtht?

what means x'1c'?

Thanks.


X'1C' = + 1 in Packed Decimal format and since you had 5 binary zeroes to the left , you now have a 6 byte Packed decimal field with a value of +1

Re: INREC

PostPosted: Wed Dec 11, 2013 4:39 pm
by itamar rocha
Hello,
Thanks for the answer.