IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reformat 20 byte field


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Eagle

New User


Joined: 13 Feb 2010
Posts: 4
Location: Cleveland, OH

PostPosted: Tue Mar 09, 2010 1:50 am
Reply with quote

First post from me. I'm using SYNCSORT FOR Z/OS 1.3.0.3R

Input description FB, LRECL=39
File is an unload from a DB2 table
First two bytes of the input file are binary
Positions 3 through 28 of the file are character
Positions 29 - 38 Date(4)
Position 39 is a null indicator added by BMC. Null is indicated by "?"

Sample input records:
Code:

.ÁBBA#000000000000001230108 2007-04-25.
.ÁBBA0000000000000004567808 2008-04-26.
.ÁBBA0000000047128205490099 ..........?

Desired output description FB, LRECL=39 --> the desired output records below correspond to the input above.
Code:
.ÁBBA0000000000000000012308 2007-04-25.
.ÁBBA0000000000000004567808 2008-04-26.
.ÁBBA0000000047128205490099 ..........?

For records with a "#" in position 6, I need to do the following:
1) remove the "#" in position 6
2) remove the value "01" in positions 24 - 25
3) right justify the remaining digits, left pad with zeroes

.ÁBBA#000000000000001230108 2007-04-25.
.ÁBBA0000000000000000012308 2007-04-25.

Records with anything other than "#" in position 6 should not be modified
The data needs to be sorted in the following sequence:
MERGE FIELDS=(1,2,BI,A,3,3,CH,A,6,20,CH,A)

If possible, please provide an example with zeroes suppressed and one without

Let me know if you need more information

Thank you!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Mar 09, 2010 2:12 am
Reply with quote

Hello and welcome to the forum,

Please note that your topic has been relocated. Syncsort topics are part of "JCL". Only DFSORT questions are to be posted in the DFSORT part of the forum because we are fortunate enough to have the IBM developers support DFSORT and we have Syncsort support in the JCL part of the forum icon_smile.gif

Also, suggest you practice a bit with the "Code" tag which will preserve alignment and improve readability for things like data, jcl, code, etc. Your data has been "Code'd".

You will also want to become familiar/comfortable with the forum SEARCH (above in the blue bar). If you search the JCL part of the forum you should find multiple IFTHEN OVERLAY examples which should do what you are looking for.
Back to top
View user's profile Send private message
Eagle

New User


Joined: 13 Feb 2010
Posts: 4
Location: Cleveland, OH

PostPosted: Tue Mar 09, 2010 8:29 pm
Reply with quote

Thanks for the information. I don't have a lot of time to browse this forum while at work, but based on what I have found so far, I can use INCLUDE COND= to located records with "#" in position 6. The part I can't get to work is the right shifting and the use of existing data in the file instead of a hard coded value.

I'd love a complete answer including the Syncsort statements.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 10, 2010 12:36 am
Reply with quote

Hello,

If you post what you have so far and show some sample input (that has run thru your code) and both the undesired output from that sample input you get as well as the output you do want, someone should be able to help.
Back to top
View user's profile Send private message
Eagle

New User


Joined: 13 Feb 2010
Posts: 4
Location: Cleveland, OH

PostPosted: Wed Mar 10, 2010 1:34 am
Reply with quote

Please see my original post. It clearly indicates my input and desired results. I'm using MERGE FIELDS because the data is being sorted in my ORDER BY clause in my unload in the previous step of the job.

I downloaded the Syncsort manuals and have started reading through them, but I am not sure how to concatenate the control statements to get the desired results. I have thought about using a combination of OVERLAY, BUILD and SQUEEZE statements, but I am confused as to how code these in a concatenated manner.

What I have so far:

Code:


MERGE FIELDS=(1,2,BI,A,3,3,CH,A,6,20,CH,A)
INCLUDE COND=(6,1,CH,EQ,C'#')             



Thank you!
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Mar 10, 2010 2:05 am
Reply with quote

Have you tried the optional IFTHEN parameter?
SyncSort for z/OS 1.3 Programmer’s Guide wrote:
The IFTHEN parameter employs conditional logic, which enables you to reformat your records based on specified criteria. Multiple IFTHEN parameters may be specified within the same control statement and are processed sequentially.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Mar 10, 2010 10:16 pm
Reply with quote

Hello Eagle,

CICS Guy is correct. Using IFTHEN logic will provide you with the desired output. For example:
Code:
//SORT  EXEC PGM=SORT                     
//SYSOUT  DD SYSOUT=*                     
//SORTIN  DD *                             
. BBA#000000000000001230108 2007-04-25.   
. BBA0000000000000004567808 2008-04-26.   
. BBA0000000047128205490099 ..........?   
//SORTOUT DD SYSOUT=*                     
//SYSIN   DD *                             
  INREC IFTHEN=(WHEN=(6,1,CH,EQ,C'#'),     
        BUILD=(1,5,C'000',7,17,26,14))     
  SORT FIELDS=(1,2,BI,A,3,3,CH,A,6,20,CH,A)
/*

The following output is produced:
Code:
. BBA0000000000000000012308 2007-04-25.
. BBA0000000000000004567808 2008-04-26.
. BBA0000000047128205490099 ..........?

Quote:
If possible, please provide an example with zeroes suppressed and one without

If I understand you correctly, then here is a SyncSort for z/OS job that will suppress the leading zeros beginning in position 6:
Code:
//SORT  EXEC PGM=SORT                                         
//SYSOUT  DD SYSOUT=*                                         
//SORTIN  DD *                                                 
. BBA#000000000000001230108 2007-04-25.                       
. BBA0000000000000004567808 2008-04-26.                       
. BBA0000000047128205490099 ..........?                       
//SORTOUT DD SYSOUT=*                                         
//SYSIN   DD *                                                 
  INREC IFTHEN=(WHEN=(6,1,CH,EQ,C'#'),                         
        BUILD=(1,5,C'000',7,17,26,14))                         
  SORT FIELDS=(1,2,BI,A,3,3,CH,A,6,20,CH,A)                   
  OUTREC BUILD=(1,5,6,20,JFY=(SHIFT=RIGHT,PREBLANK=C'0'),26,14)
/*   

The following output is produced:
Code:
. BBA                 12308 2007-04-25.
. BBA               4567808 2008-04-26.
. BBA          471282054999 ..........?
Back to top
View user's profile Send private message
Eagle

New User


Joined: 13 Feb 2010
Posts: 4
Location: Cleveland, OH

PostPosted: Wed Mar 10, 2010 10:29 pm
Reply with quote

Excellent! Thank you very much!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top