Solved

Edited Numeric fields in COBOL

Posted on 2003-12-01
8
3,086 Views
Last Modified: 2013-11-13
hi,

i'm quite new to COBOL and i have a bit of a problem. I have the following fields:

01 NUM1 PIC S9(13)V9(2).
01 NUM2 PIC -Z(12)9.99.
01 TXT1 PIC X(15).
01 COMMENT PIC X(257).

NUM1 is populated by some process, and is copied into NUM2.

I am using COMMENT for the primary output, which contains "XXXXXXXXXXXXXX, -0.00"
where XXXXXXXXXXXXXX comes from TXT and -0.00 should come from NUM2 (using the STRING command)

however, if the value in NUM2 is less than 15 characted long, eg. -12.34.....the value in COMMENT becomes:

"XXXXXXXXXXXXXX,-          12.34"

now, is there some other way to make the output similar to this:

"XXXXXXXXXXXXXX,-12.34"??

thanks
0
Comment
Question by:logbook
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 15

Accepted Solution

by:
Raisor earned 250 total points
ID: 9856778
Hi,

Have you tried the INSPECT verb to edit the 15 digit numeric field in the input record to produce the desired number format on the output file?

Best regards, Raisor
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9860242
logbook,

Try changing

01 NUM2 PIC -Z(12)9.99.

to

01 NUM2 PIC -(13)9.99.

Dang123
0
 
LVL 9

Assisted Solution

by:Dang123
Dang123 earned 250 total points
ID: 9860636
logbook,

This may help you if you want to pull the number up against the string.

http://dbforums.com/arch/91/2003/1/666266

Dang123
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:Raisor
ID: 9861177
Hi,

@Dang123 ... your link http://dbforums.com/arch/91/2003/1/666266 links to the same suggestion as mine: "Have you tried the INSPECT verb to edit the 15 digit numeric field in the input record to produce the desired number format on the output file?" What I see is that your link comes with some good examples!


Your question should be answered now, logbook!


Best regards, Raisor
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9861236
Raisor,
    The link I posted wasn't meant to overstep your suggestion, there are a number of solutions on the page. I haven’t needed to left justify a number before (and still don't) so I only took a quick look at the page. Sorry, didn't mean to offend.

    Your right though, between our suggestions logbook should be able to get the program working.

Dang123

0
 
LVL 15

Expert Comment

by:Raisor
ID: 9861389
Hi,

Well I’m sorry, Dang123, I absolutely didn’t want to express that I felt offended … there seems to be a misunderstanding!

What I was up to say was that I think I gave a hint to the right direction but that you gave the better examples.

My conclusion though was the same as yours: “between our suggestions logbook should be able to get the program working” …


Best regards, Raisor
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9861451
Raisor,
    Thanks, I wasn't sure if you were upset or not, I glad you not.

logbook,
    How are you making out with your program? Have you gotten closer to what you need?

Dang123


0
 

Author Comment

by:logbook
ID: 9989246
sorry i wasnt able to get back to this question since i posted it....

thanks for the help guys, but i was able to accomplish it using an unstring - string algo a friend came up....

cheers
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this post we will learn different types of Android Layout and some basics of an Android App.
Simple Linear Regression
Introduction to Processes

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question