|
View previous topic :: View next topic
|
| Author |
Message |
pullaiah.cts
New User
Joined: 02 Sep 2010 Posts: 50 Location: Pune
|
|
|
|
Hi,
I need to edit the price in the input dataset based on product code and payment type
Product code - starting position 30 and length is 5 (Ex: 00003)
Payment type - starting position 49 and length is 3 (Ex: ADD)
Price - Starting position 43 - S9(9)V99 COMP-3
Input dataset:
| Code: |
----+----1----+----2----+----3----+----4----+----5-
001000000000000000123456789AB0000220131107 ADD
001000000000000000123456789AB0000220131107 ADD
001000000000000000123456789AB0000320131107 ADD
001000000000000000123456789AB0000320131107 ADD
001000000000000000123456789AB0000320131107 NEW
001000000000000000123456789AB0000320131107 & NEW
001000000000000000123456789AB0000320131105 %NEW
|
Req:
1. If product code is not '00003' then copy the all the fields to output dataset with payment as blank
2. If product code is '00003'
- If Payment type is NEW then copy all the fields to output dataset with payment as blank
- If Payment type is ADD then copy all the fields to output dataset with price as ZERO and payment type as blank
JCL Code:
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(30,5,CH,NE,C'00003'),OVERLAY=(49:C' ')),
IFTHEN=(WHEN=(30,5,CH,EQ,C'00003'),OVERLAY=(30:C'00003'),
HIT=NEXT),
IFTHEN=(WHEN=(49,3,CH,NE,C'ADD'),OVERLAY=(49:C' '),
HIT=NEXT),
IFTHEN=(WHEN=(49,3,CH,EQ,C'ADD'),
OVERLAY=(43:+0,TO=ZDC,LENGTH=6,49:C' '))
/*
|
Output dataset:
| Code: |
----+----1----+----2----+----3----+----4----+----5-
001000000000000000123456789AB0000220131107
001000000000000000123456789AB0000220131107
001000000000000000123456789AB000032013110700000{
001000000000000000123456789AB000032013110700000{
001000000000000000123456789AB0000320131107
001000000000000000123456789AB0000320131107 &
001000000000000000123456789AB0000320131105 %
001000000000000000123456789AB0000320131107
|
The issue here is, I am getting '00000{' instead of COMP-3 data. I want to mention ZERO price in COMP-3 format. Can you please let me know what exactly I need to mention in the OVERLAY field? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| You are getting zero in packed-decimal. the curly brace is telling you that it is a positive zero at that digit. The other curly brace would tell you it is a negative zero at the same position. A-I will be positive 1-9 and J-R negative 1-9. |
|
| Back to top |
|
 |
pullaiah.cts
New User
Joined: 02 Sep 2010 Posts: 50 Location: Pune
|
|
|
|
Hi Bill,
But when I give o/p dataset as input to my COBOL program, it is getting failed with SOC 7 error. Below is the declaration for price filed in COBOL program
| Code: |
10 TR00-CSTAMT PICTURE S9(9)V99 COMPUTATIONAL-3
|
What's the issue with the data in the output dataset? Please clarify |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
I believe you are actually specifying Zoned Decimal output not Packed Decimal output. These are the values for DISPLAY values that are negative:
| Code: |
0} = -0
0J = -1
0K = -2
0L = -3
0M = -4
0N = -5
0O = -6
0P = -7
0Q = -8
0R = -9 |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Good spot NicC. TO=ZDC is zoned-decimal. Try TO=PD. |
|
| Back to top |
|
 |
pullaiah.cts
New User
Joined: 02 Sep 2010 Posts: 50 Location: Pune
|
|
|
|
Yeah, you are right Nic. I have changed it to PD an everything is working fine now
| Code: |
OVERLAY=(43:+0,TO=PD,LENGTH=6,49:C' '))
|
Thanks a lot for your response. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
sometimes I do NOT muck it up  |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(30,5,CH,NE,C'00003'),OVERLAY=(49:C' ')),
IFTHEN=(WHEN=(30,5,CH,EQ,C'00003'),OVERLAY=(30:C'00003'),
HIT=NEXT),
IFTHEN=(WHEN=(49,3,CH,NE,C'ADD'),OVERLAY=(49:C' '),
HIT=NEXT),
IFTHEN=(WHEN=(49,3,CH,EQ,C'ADD'),
OVERLAY=(43:+0,TO=PD,LENGTH=6,49:C' '))
/* |
pullaiah.cts,
Are you sure the above is correct?
When 30,5 is equal to C'00003' you set 30: to C'00003', which is the value you know it already has.
What you seem to by trying to do is to set a field to zero if C'00003' and ADD. You can do that in on IFTHEN=(WHEN=(logical-expression. Put the zero and blat the ADD in the OVERLAY. Then have an IFTHEN=(WHEN=NONE to blat the field which sometimes contains ADD to space for all the other records. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|