View previous topic :: View next topic
|
Author |
Message |
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
ok, back to expat's original question:
what is the field layout of the input record and output record? |
|
Back to top |
|
|
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
Its PICX(30) for both input and output |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
|