Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Editing COMP-3 data using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Fri Nov 15, 2013 2:34 pm    Post subject: Editing COMP-3 data using SORT
Reply with quote

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
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 15, 2013 2:48 pm    Post subject: Reply to: Editing COMP-3 data using SORT
Reply with quote

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
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Fri Nov 15, 2013 3:08 pm    Post subject: Editing COMP-3 data using SORT
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Fri Nov 15, 2013 3:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 15, 2013 3:27 pm    Post subject: Reply to: Editing COMP-3 data using SORT
Reply with quote

Good spot NicC. TO=ZDC is zoned-decimal. Try TO=PD.
Back to top
View user's profile Send private message
pullaiah.cts

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Fri Nov 15, 2013 3:28 pm    Post subject: Editing COMP-3 data using SORT
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Fri Nov 15, 2013 3:31 pm    Post subject:
Reply with quote

sometimes I do NOT muck it up icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 15, 2013 4:54 pm    Post subject: Reply to: Editing COMP-3 data using SORT
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us