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
 

 

Reformat 20 byte field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Reformat 20 byte field
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

Site Director


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

PostPosted: Tue Mar 09, 2010 2:12 am    Post subject:
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    Post subject: Reply to: Reformat 20 byte field
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

Site Director


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

PostPosted: Wed Mar 10, 2010 12:36 am    Post subject:
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    Post subject: Reply to: Reformat 20 byte field
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: 2150
Location: At my coffee table

PostPosted: Wed Mar 10, 2010 2:05 am    Post subject:
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: 500
Location: USA

PostPosted: Wed Mar 10, 2010 10:16 pm    Post subject:
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    Post subject: Reply to: Reformat 20 byte field
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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