[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Edited Numeric fields in COBOL

Posted on 2003-12-01
8
Medium Priority
?
3,104 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:
Ralf Klatt earned 500 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 500 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 15

Expert Comment

by:Ralf Klatt
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:Ralf Klatt
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Simple Linear Regression
Screencast - Getting to Know the Pipeline

834 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