× 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.



Thanks so much for the debug assist.

I should have given you more of the code.

In hindsight, it is obvious that I was moving text to the GROUP data name A0403X-MEMO-TEXT (instead of same "-DATA").

So the first alpha character was dropping into the LENGTH field, which caused it to be a meaningless value.

move AMTEXT to A0403X-MEMO-TEXT <-----------should end with "-DATA".
add 81 to A0403X-MEMO-TEXT-LENGTH



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).


Thanks!


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bruce Vining
Sent: Saturday, July 21, 2012 9:48 AM
To: COBOL Programming on the iSeries/AS400
Subject: Re: [COBOL400-L] variable length field - how to rewrite a record

As your Add statement is correct I have to question the assertion that
A0403X-MEMO-TEXT-LENGTH is 0. Prior to running the Add statement I have to
suspect that A0403X-MEMO-TEXT-LENGTH is -5996. This could be caused by a
variety of things -- for instance if the storage associated with
A0403X-MEMO-TEXT was also defined as say PIC X(1), then previously setting
the PIC X(1) field to Y (a rather suspicious value) would cause a negative
value when viewing A0403X-MEMO-TEXT-LENGTH. Specifically a value of 'Ym'
(where the 'm' could be coming from most anywhere and defined as most
anything) would cause a "starting" value of -5996 for
A0403X-MEMO-TEXT-LENGTH.
A similar situation, though clearly not the one you encountered, would be
for A0403X-MEMO-TEXT-LENGTH (after the Add statement) to be 6529. This
would be the case where the storage associated with A0403X-MEMO-TEXT-LENGTH
was set to blanks prior to the Add (which under the covers would be 16448
interpreted as the 4-digit value 6448 + 81).

An eval A0403X-MEMO-TEXT-LENGTH:x immediately prior to the Add statement
running would be helpful, along with a more complete view of the copybook
and prior processing.

Bruce Vining

On Fri, Jul 20, 2012 at 1:17 PM, Stone, Joel <Joel.Stone@xxxxxxxxxx> wrote:

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
______________________________________________________________________

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.


________________________________________________________________________
This inbound email has been scanned for all viruses by the MessageLabs
SkyScan
service.
________________________________________________________________________

______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs
Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.