Re-position the records



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Re-position the records

Postby ansh_4702 » Tue Nov 30, 2010 7:52 pm

Hello,

I have one flat file having millions of records. The records are starting from position 2. I want to shift all the records by 1 position into the new file (meaning the records should start from position 3). Total length of the file is 80.

Can anyone suggest a sort card for this? Please help.
ansh_4702
 
Posts: 33
Joined: Thu Jan 08, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re-position the records

Postby Alissa Margulies » Tue Nov 30, 2010 10:16 pm

If the original File was FB/80, then you can code something like the following:
//SYSIN DD *               
  INREC BUILD=(1:3,78,80:X)
  SORT FIELDS=COPY         
/*                         
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Re-position the records

Postby ansh_4702 » Wed Dec 01, 2010 4:21 pm

Thanks Alisa,

But this is not working. The output recs are now starting from position 1 (instead of 3) and its truncating the first position data as well.
On further investigating the reqmt, there are some add into the earlier reqmt:
The length of the file is 130. Currently all the fileds in the i/p file are seperated by one space. Now I want to have two spaces b/w all the fields records.

i.e. the i/p file is like below: (Te first rec is starting from position 2)
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
********************************* Top of Data **************************
 00001 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666
 00001 7777777777 8888888888 9999999999 0000000000 1111111111 2222222222
 



Now I want the o/p in this format (All the fields should be seperated by two spaces):
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
  00001  1111111111  2222222222  3333333333  4444444444  5555555555  6666666666
  00001  7777777777  8888888888  9999999999  0000000000  1111111111  2222222222




Please advice if it can be done with the sort card.
ansh_4702
 
Posts: 33
Joined: Thu Jan 08, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re-position the records

Postby Alissa Margulies » Wed Dec 01, 2010 9:43 pm

ansh_4702 wrote:The output recs are now starting from position 1 (instead of 3) and its truncating the first position data as well.

I misunderstood the initial requirement. This code should reposition the data as desired:
//SYSIN DD *               
  SORT FIELDS=COPY   
  OUTREC BUILD=(3:1,130)     
/*     


ansh_4702 wrote:On further investigating the reqmt, there are some add into the earlier reqmt:
The length of the file is 130. Currently all the fileds in the i/p file are seperated by one space. Now I want to have two spaces b/w all the fields records.

Are these the only other requirements that we need to know about before we work on the solution?
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Re-position the records

Postby Alissa Margulies » Wed Dec 01, 2010 11:32 pm

Here is a sample job that may help you accomplish your task:
//S1    EXEC PGM=SORT                                                   
//SYSOUT  DD SYSOUT=*                                                   
//SORTOUT DD SYSOUT=*                                                   
//SORTIN  DD *                                                         
00001 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666
00001 7777777777 8888888888 9999999999 0000000000 1111111111 2222222222
//SYSIN   DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(3:1,80,130:X)),                       
         IFTHEN=(WHEN=INIT,                                             
         FINDREP=(INOUT=(C' ',C'  '),STARTPOS=3,ENDPOS=82))         
/*                                                                       
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Re-position the records

Postby ansh_4702 » Thu Dec 02, 2010 4:11 pm

Thanks so much Alissa,

Its working and got the result as desired. Thanks so much once again for your kind help.
ansh_4702
 
Posts: 33
Joined: Thu Jan 08, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re-position the records

Postby ansh_4702 » Fri Dec 17, 2010 5:52 pm

Just one more query related to same topic:

My input file has two date fields coming together without any space b/w them. The reqmt is to seperate them by a space. Here are the few records from the i/p file:
The first date field starts from position 39 and 2nd date field starts from position 49. The date year could be anything..so need a generic sort card.

--+----4----+----5----+----6----+
* Top of Data *******************
888888[b]1900-01-019999-12-31  [/b]00001
[b]8888881900-01-012000-12-31  [/b]00001


Please advice.
ansh_4702
 
Posts: 33
Joined: Thu Jan 08, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re-position the records

Postby ansh_4702 » Fri Dec 17, 2010 5:55 pm

Data is like that:

--+----4----+----5----+----6----+
* Top of Data *******************
8888881900-01-019999-12-31  00001
8888881900-01-012000-12-31  00001

ansh_4702
 
Posts: 33
Joined: Thu Jan 08, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re-position the records

Postby Alissa Margulies » Fri Dec 17, 2010 8:50 pm

Assuming the input file is FB/80, here is a SyncSort job that will do what you have asked:
//STEP1 EXEC PGM=SORT                                           
//SYSOUT  DD SYSOUT=*                                           
//SORTIN  DD *                                                 
                                8888881900-01-099999-12-31  00001
                                8888881900-01-012000-12-31  00001
//SORTOUT DD SYSOUT=*                                           
//SYSIN   DD *                                                   
  SORT FIELDS=COPY                                               
  OUTREC BUILD=(1,48,X,49,32)
/*                                   

Please note that since you are inserting a space, the output LRECL will be 81.

Regards,
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Re-position the records

Postby ansh_4702 » Tue Dec 21, 2010 5:19 pm

Its working. Thanks for your help !!
ansh_4702
 
Posts: 33
Joined: Thu Jan 08, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post