× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



OK

But why is 0 + 81 = -5915 ???


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S Waterbury
Sent: Friday, July 20, 2012 12:57 PM
To: COBOL Programming on the iSeries/AS400
Subject: Re: [COBOL400-L] variable length field - how to rewrite a record

Joel:

COMP-4 means binary. PIC S9(4) is equivalent to PIC S9999 ... that's
four decimal digits ... that fits into two bytes in binary ... aka. a
halfword.

HTH,

Mark S. Waterbury

On 7/20/2012 1:11 PM, Stone, Joel wrote:
From COPY statement:

06 A0403X-MEMO-TEXT.
(Variable length field)
49 A0403X-MEMO-TEXT-LENGTH
PIC S9(4) COMP-4.
49 A0403X-MEMO-TEXT-DATA
PIC X(1619).
A0403X MEMO TEXT




In debug, the length field (comp-4) is zero

I have the following line incrementing the length:

add 81 to A0403X-MEMO-TEXT-LENGTH

in debug after this add stmt executes, the value is shown as

Variable . . . . . . . . . . . . . . . : 49 A0403X-MEMO-TEXT-LENGTH
Type . . . . . . . . . . . . . . . . : SIGNED BINARY
Length . . . . . . . . . . . . . . . : 2
' -5915'




How do I properly increment the length of the field?? Where is -5915 coming from?? I think it should show 81, correct?

Should the 81 be coded as x'00000081' or x'00000051' or something else???

I tried

add X'00000051' to A0403X-MEMO-TEXT-LENGTH

but get compiler error

234 MSGID: LBL1447 SEVERITY: 30 SEQNBR: 022100
Message . . . . : Statement incomplete; last valid item found
before 'X"00000051"'. Statement ignored.
234 MSGID: LBL0018 SEVERITY: 00 SEQNBR: 022100
Message . . . . : Input ignored starting with 'X"00000051"'.



Thanks



______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.