View previous topic :: View next topic
|
Author |
Message |
chetanambi
New User
Joined: 21 Jan 2012 Posts: 58 Location: India
|
|
|
|
Hi All,
I am trying to write some of the selected selected fields from the input file to an output file. I have defined input and output layout as below:
Input layout
Code: |
FILE INPTFILE
INPT-REC 1 200 A
INPT-DIV 1 2 N
INPT-CUST 3 16 N
INPT-ACCT-TYPE 19 2 N
INPT-RETAIL-DIV 21 2 N
INPT-TRAS-DATE 23 7 N
INPT-LOC 30 4 N
INPT-TERMINAL 34 7 N
INPT-TRANSACTION 41 7 N
INPT-TOT-AMT 84 9 N 2
INPT-DEPT 104 3 N
INPT-CLASS 107 2 N
INPT-LINE-ITEM-AMT 109 9 N 2
INPT-DISCOUNT 118 7 N 2
INPT-TAX-DISCOUNT 125 7 N 2
INPT-MARKDN-AMT 132 9 N 2
INPT-ASSOC-ID 148 8 N
INPT-NEW-LOC 192 4 A
|
Output layout:
Code: |
OUTP-REC 1 200 A
OUTP-DIV 1 2 N
OUTP-CUST 4 16 N
OUTP-ACCT-TYPE 21 2 N
OUTP-RETAIL-DIV 24 2 N
OUTP-TRAS-DATE 27 7 N
OUTP-LOC 35 4 N
OUTP-NEW-LOC 40 4 A
OUTP-TERMINAL 45 7 N
OUTP-TRANSACTION 53 7 N
OUTP-TOT-AMT 61 9 N 2
OUTP-DEPT 71 3 N
OUTP-CLASS 75 2 N
OUTP-LINE-ITEM-AMT 78 9 N 2
OUTP-DISCOUNT 88 7 N 2
OUTP-TAX-DISCOUNT 96 7 N 2
OUTP-MARKDN-AMT 104 9 N 2
OUTP-ASSOC-ID 114 8 N
|
in the main logic i am just moving input varaible to output fields like below:
Code: |
OUTP-DIV = INPT-DIV
OUTP-CUST = INPT-CUST
OUTP-ACCT-TYPE = INPT-ACCT-TYPE
OUTP-RETAIL-DIV = INPT-RETAIL-DIV
OUTP-TRAS-DATE = INPT-TRAS-DATE
OUTP-LOC = INPT-LOC
OUTP-NEW-LOC = INPT-NEW-LOC
OUTP-TERMINAL = INPT-TERMINAL
OUTP-TRANSACTION = INPT-TRANSACTION
OUTP-TOT-AMT = INPT-TOT-AMT
OUTP-DEPT = INPT-DEPT
OUTP-CLASS = INPT-CLASS
OUTP-LINE-ITEM-AMT = INPT-LINE-ITEM-AMT
OUTP-DISCOUNT = INPT-DISCOUNT
OUTP-TAX-DISCOUNT = INPT-TAX-DISCOUNT
OUTP-MARKDN-AMT = INPT-MARKDN-AMT
OUTP-ASSOC-ID = INPT-ASSOC-ID
PUT OUTPFILE
|
But in the output file I am not getting data in proper format for signed numeric fields as below.
Code: |
402 000007536 303 05 00000532M 0001065 0000000 00000425R 00000201
918 000070525 284 15 00006500} 0009750 0000829 00005525} 00000201
905 000007967 121 14 00000219Q 0000440 0000126 00000175Q 00000201
|
In the above 532M indicates total amount (TOT-AMT).
I tried with MASK option but still not getting desired resutls. Please help me out. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Easytrieve Plus MASKs are only used for DISPLAY and PRINT.
All fields defined with implied decimal places, like 9 N 2, the 2 is two decimal places, are signed.
You are "getting data in proper format for signed numeric fields". That is what signed fields look like on a file.
If you look here you'll find out what the M in 532M means. |
|
Back to top |
|
|
chetanambi
New User
Joined: 21 Jan 2012 Posts: 58 Location: India
|
|
|
|
Hi Bill,
Thanks for the quick response..
Yes.. If I display that amount field it will be 53.240 and also in file-aid. I want this -53.24 to be written to ouput file as well. Is there any possibilit? Even if you can give hint I would love to find out |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, since you're keen:
This post references a CA-supplied macro which converts in the "other direction", so maybe see if they supply something which does what you want, or look at the macro and write your own for this conversion.
Another way is to write a simple Cobol program which will be defined as a "PRINTER EXIT", that is, specify it as an "EXIT" for a PRINTER file. You DISPLAY the field with the required MASK, and the COBOL program, instead of writing to a file, just returns the value which was edited by Easytrieve Plus.
EDIT:
An example PRINTER EXIT is now here. |
|
Back to top |
|
|
|