Solved

Edited Numeric fields in COBOL

Posted on 2003-12-01
8
3,057 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now