Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Output reformat

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 4:16 pm    Post subject: Output reformat
Reply with quote

Hi,
I have a field with below information combined
NAME,ACCOUNTNO,(I/R) and PRICE.
I want the price field which is the last field to be put in file as in below output format.

could you please help me in this.

Input Output
---------------- -----------------------
ROB0108978I70.5 = ROB0108978I00070500
RICK01086781R600 = RICK01086781R00600
DENNIS0158978I1.89 = DENNIS0158978I00001890
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Apr 30, 2010 4:35 pm    Post subject:
Reply with quote

Even if I were a COBOL programmer, with the amount of information and detail that you have given, I doubt very much if I could help you.

Please explain in detail the input format, the output format, and the rules for getting from input to output. You might know the rules but unfortunately psychic day was Thursday this week icon_cry.gif
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 5:08 pm    Post subject:
Reply with quote

Input
----------------
ROB0108978I70.5
RICK01086781R600
DENNIS0158978I1.89

Output
------------------------
ROB0108978I00070500
RICK01086781R00600
DENNIS0158978I00001890

from last we see till it finds an I or R its a price field
for first record In input the price is 70.5 but in output the price has to be 00070500

I hope I am clear now
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 30, 2010 5:35 pm    Post subject:
Reply with quote

the edit masks are not consistant:

Code:

 70.5   >> 00070500        << 3 decimal positions
  1.89  >> 00001890        << only 2
600     >> 00600              << none

why not
 70.5   >> 00070500
  1.89  >> 00001890
600     >> 00600000
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 5:38 pm    Post subject:
Reply with quote

Hi Dick,
Yes you are correct . It will be exactly the way u mentioned.
But the entire field is a PIC X(30)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 30, 2010 5:41 pm    Post subject:
Reply with quote

ok, back to expat's original question:

what is the field layout of the input record and output record?
Back to top
View user's profile Send private message
dp33770

New User


Joined: 04 Jul 2007
Posts: 92
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 5:51 pm    Post subject:
Reply with quote

Its PICX(30) for both input and output
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 30, 2010 6:11 pm    Post subject:
Reply with quote

Here is a starter:

Code:
move zero to R-COUNT, I-COUNT
INSPECT REVERSE(INPUT) tallying R-COUNT to first 'R'
INSPECT REVERSE(INPUT) tallying I-COUNT to first 'I'

EVALUATE TRUE
       WHEN R-COUNT = ZERO AND I-COUNT=ZERO
                 GOT A PROBLEM - display error and read next record
        WHEN R-COUNT = ZERO
                  COMPUTE SPLIT-COUNT = LENGTH(INPUT) - I-COUNT
                  MOVE I-COUNT TO R-COUNT
         WHEN OTHER
                  COMPUTE SPLIT-COUNT = LENGTH(INPUT) - R-COUNT
END-EVALUATE
move spaces to 10-char-x-type-field
if input(split-count:r-count) numeric
then
  MOVE INPUT(SPLIT-COUNT:R-COUNT) TO 10-char-x-type-field
end-if
compute 9(7)v999-field = numval(10-char-x-type-field)
move spaces to ouptut-field

string input(1:split-count)
        9(7)v999-field
into output-field
end-string
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us