Re: Quick I hope COBOL question

2006-10-19 Thread Steve Comstock

Charles Mills wrote:

Thanks all! It's been working for over a week now .

It's one DISPLAY statement in a 200-line test program, and hopefully it's
about the last COBOL program I have to write, so hopefully the way I did it
(per the first suggestion received here) is good enough.

The below example is more or less the way I was trying to do it before I
gave up and asked the question. My COBOL education stopped in about 1980*
and so I was vaguely familiar with OCCURS DEPENDING but not the (from : to)
substring function.

Charles

*No Steve, I don't need a class. 



Awww. Beat me to the punch. 

Kind regards,

-Steve Comstock

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Quick I hope COBOL question

2006-10-19 Thread Charles Mills
Thanks all! It's been working for over a week now .

It's one DISPLAY statement in a 200-line test program, and hopefully it's
about the last COBOL program I have to write, so hopefully the way I did it
(per the first suggestion received here) is good enough.

The below example is more or less the way I was trying to do it before I
gave up and asked the question. My COBOL education stopped in about 1980*
and so I was vaguely familiar with OCCURS DEPENDING but not the (from : to)
substring function.

Charles

*No Steve, I don't need a class. 

-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf
Of Thompson, Steve (SCI TW)
Sent: Thursday, October 19, 2006 6:21 AM
To: IBM-MAIN@BAMA.UA.EDU
Subject: Re: Quick I hope COBOL question

-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On
Behalf Of Clark Morris
Sent: Wednesday, October 18, 2006 6:17 PM
To: IBM-MAIN@BAMA.UA.EDU
Subject: Re: Quick I hope COBOL question

On 9 Oct 2006 14:24:46 -0700, in bit.listserv.ibm-main you wrote:

>I know this isn't the COBOL list. I'm not a COBOL programmer, so it all
>works out. I'm writing a quick COBOL test program. I've got a PIC X(64)
>field but the actual length of the data in the field is in a separate
S9(4)
>field. I want to display the real data and not whatever garbage might
be
>beyond the real data. Is there any easy way to do this?
DISPLAY Pic-X-64-field (1 : X-64-Actual-data-length).


You might try something similar to the following:

05 PIC-VAR-MOVE REDEFINES PIC-X-64-FIELD.
  07 FILLER PIC X OCCURS DEPENDING ON
LENGTH-FIELD-S9.

Change the group level (05) to match the same level as the
PIC-X-64-FIELD. Then the LENGTH-FIELD-S9 becomes the name of the field
having the length in it.

Now this NEW group level, PIC-VAR-MOVE dynamically changes in size to
match the size of the table you have defined. So a MOVE using this as
the source will only move the number of bytes given by the length field.
You might also want to modify this to say "OCCURS 1 TO XX TIMES
DEPENDING ON..." to avoid an overflow condition.

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Quick I hope COBOL question

2006-10-19 Thread Thompson, Steve (SCI TW)
-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On
Behalf Of Clark Morris
Sent: Wednesday, October 18, 2006 6:17 PM
To: IBM-MAIN@BAMA.UA.EDU
Subject: Re: Quick I hope COBOL question

On 9 Oct 2006 14:24:46 -0700, in bit.listserv.ibm-main you wrote:

>I know this isn't the COBOL list. I'm not a COBOL programmer, so it all
>works out. I'm writing a quick COBOL test program. I've got a PIC X(64)
>field but the actual length of the data in the field is in a separate
S9(4)
>field. I want to display the real data and not whatever garbage might
be
>beyond the real data. Is there any easy way to do this?
DISPLAY Pic-X-64-field (1 : X-64-Actual-data-length).


You might try something similar to the following:

05 PIC-VAR-MOVE REDEFINES PIC-X-64-FIELD.
  07 FILLER PIC X OCCURS DEPENDING ON
LENGTH-FIELD-S9.

Change the group level (05) to match the same level as the
PIC-X-64-FIELD. Then the LENGTH-FIELD-S9 becomes the name of the field
having the length in it.

Now this NEW group level, PIC-VAR-MOVE dynamically changes in size to
match the size of the table you have defined. So a MOVE using this as
the source will only move the number of bytes given by the length field.
You might also want to modify this to say "OCCURS 1 TO XX TIMES
DEPENDING ON..." to avoid an overflow condition.

Later,
Steve Thompson

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Quick I hope COBOL question

2006-10-18 Thread Clark Morris
On 9 Oct 2006 14:24:46 -0700, in bit.listserv.ibm-main you wrote:

>I know this isn't the COBOL list. I'm not a COBOL programmer, so it all
>works out. I'm writing a quick COBOL test program. I've got a PIC X(64)
>field but the actual length of the data in the field is in a separate S9(4)
>field. I want to display the real data and not whatever garbage might be
>beyond the real data. Is there any easy way to do this?
DISPLAY Pic-X-64-field (1 : X-64-Actual-data-length).

>
> 
>
>Thanks!
>
>Charles Mills
>+1-707-291-0908
Clark Morris cfmpublic at ns.sympatico.ca

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Quick I hope COBOL question

2006-10-09 Thread Charles Mills
Awesome! Thanks,

Charles

-Original Message-
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf
Of Kirk Talman
Sent: Monday, October 09, 2006 2:31 PM
To: IBM-MAIN@BAMA.UA.EDU
Subject: Re: Quick I hope COBOL question

77  D   PIC X(64)
.
.
.
77  L   PIC S9(4)   BINARY.
.
.
.
MOVE D (1:L) TO wherever
.
.
.
DISPLAY D (1:L)


IBM Mainframe Discussion List  wrote on 10/09/2006 
05:24:27 PM:

> I know this isn't the COBOL list. I'm not a COBOL programmer, so it all
> works out. I'm writing a quick COBOL test program. I've got a PIC X(64)
> field but the actual length of the data in the field is in a separate 
S9(4)
> field. I want to display the real data and not whatever garbage might be
> beyond the real data. Is there any easy way to do this?

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: Quick I hope COBOL question

2006-10-09 Thread Kirk Talman
77  D   PIC X(64)
.
.
.
77  L   PIC S9(4)   BINARY.
.
.
.
MOVE D (1:L) TO wherever
.
.
.
DISPLAY D (1:L)


IBM Mainframe Discussion List  wrote on 10/09/2006 
05:24:27 PM:

> I know this isn't the COBOL list. I'm not a COBOL programmer, so it all
> works out. I'm writing a quick COBOL test program. I've got a PIC X(64)
> field but the actual length of the data in the field is in a separate 
S9(4)
> field. I want to display the real data and not whatever garbage might be
> beyond the real data. Is there any easy way to do this?



-
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed.  The information may also constitute a legally
privileged confidential communication.  If the reader of this
message is not the intended recipient or an agent responsible for
delivering it to the intended recipient, you are hereby notified
that you have received this communication in error and that any
review, dissemination, copying, or unauthorized use of this
information, or the taking of any action in reliance on the
contents of this information is strictly prohibited.  If you have
received this communication in error, please notify us immediately
by e-mail, and delete the original message.  Thank you

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Quick I hope COBOL question

2006-10-09 Thread Charles Mills
I know this isn't the COBOL list. I'm not a COBOL programmer, so it all
works out. I'm writing a quick COBOL test program. I've got a PIC X(64)
field but the actual length of the data in the field is in a separate S9(4)
field. I want to display the real data and not whatever garbage might be
beyond the real data. Is there any easy way to do this?

 

Thanks!

Charles Mills
+1-707-291-0908

 


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html