IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Output reformat


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dp33770

New User


Joined: 04 Jul 2007
Posts: 91
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 4:16 pm
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: 8797
Location: Welsh Wales

PostPosted: Fri Apr 30, 2010 4:35 pm
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: 91
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 5:08 pm
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
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: 91
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 5:38 pm
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
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: 91
Location: Hyderabad

PostPosted: Fri Apr 30, 2010 5:51 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
Search our Forums:

Back to Top