My requirement is based on the key in position 5 and of length 6 characters. I need to generate the count of records and also the total amount for each key value. Then populate the output file as mentioned below:
1. Previous Days Date in CCYYMMDD format
2. Key value 6 characters in length
3. Count in ZD format and length is 15
4. Amount value in 956 position in PD format (13,2) and the output in the format PD.
I'm unable to get the date and also the amount is in ZD format.
Can this requirement be achieved in one step.
------------------------------------------------------------
I'm unable to get the date and also the amount is in ZD format
You will have to tell clearly what the exact issue that you are facing, like sample input, expected output should do.
You need to use EDIT to get in ZD in TRAILER3 for TOT. are you sure you need date for every trailer or once as header?
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
From what you have described above, you can do this in one step and you are almost there.
Does the input PD amount start at position-956? But the card above shows 960. What does this indicate : PD format (13,2)? Can you post the equivalent COBOL field definition?
And for the previous date, you might need to use DATE1-1 in the INREC and use that field in your TRAILER3.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
hemanthj642,
For your packed-decimal total, you need to "convert" the result to packed-decimal, by specifying TO=PD.
960,7,PD gives its output as a ZD (with a documented default length).
I despair of the dates. What if your step runs on the "wrong" day? Like a re-run, or in testing of any type? Or the step simply running late.?
If your site is so fantastic that you never do a re-run, you don't need testing, and the batch is always complete on time, then by all means use the system dates.
Arun,
The change in position is due to the variable-length input records. The 13,2 has two decimal-digits as part of the total of 13 digits.
Rohit,
You don't need an EDIT to get ZD, and also TS/OP doesn't even want a ZD.