View previous topic :: View next topic
|
Author |
Message |
av_sukumar
New User
Joined: 12 Oct 2004 Posts: 6
|
|
|
|
Hi,
Could any one please let me know the solution for the below problem.
My requirement is to add the gross field of all the records exists in
a file. But this file is again a report file from a program and the gross
filed in this one has commas, for example 2,000.00.
When I am trying to add the gross filed then easy trieve is not working
because of commas it is abending. So, could any one tell me how to
eliminate the commas in easytrive program or tell me is there any better
way the above can be done.
Your quick reply will be appreciated. Thank you. |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
The easier way is to modify the previous program to write a file without the commas or have the previous program write both reports.
If you can not do that something like this may work for you.
Code: |
*------ FIELD LEVEL/NAME ---------- -- START LENGTH PICTURE--
IN-FIELD1 01 14 A
IN-FIELD2 16 14 A
** 11111 *
** 12345678901234 *
** 999,999,999.99 *
W1-FIELD 01 14 A
W1-FIELD1 W1-FIELD 03 A
W1-FIELD2 W1-FIELD +04 03 A
W1-FIELD3 W1-FIELD +08 03 A
W1-FIELD4 W1-FIELD +12 02 A
** 11 *
** 123 456 789 01 *
** 999 999 999 99 *
W2-FIELD W 11 N 02
W2-FIELD1 W2-FIELD 03 A
W2-FIELD2 W2-FIELD +03 03 A
W2-FIELD3 W2-FIELD +06 03 A
W2-FIELD4 W2-FIELD +09 02 A
W2-FIELDA W2-FIELD 01 A +
OCCURS 11 INDEX CNT
**
OUT-FIELD1 W 11 N 02
OUT-FIELD2 W 11 N 02
*
JOB INPUT INFILE
W1-FIELD = IN-FIELD1
PERFORM REMOVE-COMMAS
OUT-FIELD1 = W2-FIELD
W1-FIELD = IN-FIELD2
PERFORM REMOVE-COMMAS
OUT-FIELD2 = W2-FIELD
...
*
REMOVE-COMMAS. PROC.
W2-FIELD1 = W1-FIELD1
W2-FIELD2 = W1-FIELD2
W2-FIELD3 = W1-FIELD3
W2-FIELD4 = W1-FIELD4
CNT = 0
DO WHILE CNT LE 11
IF W2-FIELDA NOT NUMERIC
W2-FIELDA = '0'
END-IF
CNT = CNT + 1
END-DO
END-PROC.
* |
I hope this helps. |
|
Back to top |
|
|
|