Solved

Edited Numeric fields in COBOL

Posted on 2003-12-01
8
3,062 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
nestparen challenge 4 73
Scripting vs. Programming languages 25 152
Not needed 13 95
how to recover a android "temp_video" that did not get processed before the phone rebooted 3 39
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…

867 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

15 Experts available now in Live!

Get 1:1 Help Now