Conversion from trailing spaces of text to low-values



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

Conversion from trailing spaces of text to low-values

Postby akanchu » Wed Jan 13, 2010 11:10 am

I have a file that about 400 bytes of data.
Few fields in this file has data in the following format.

1799 ARBYDALE LN                                         
FFFF4CDCECCDC4DD444444444444444444444444444444444444444444
1799019284135035000000000000000000000000000000000000000000
----------------------------------------------------------
1234 HILTON WHITEMALL RD                                 
FFFF4CCDEDD4ECCECDCDD4DC4444444444444444444444444444444444
1234089336506893541330940000000000000000000000000000000000
----------------------------------------------------------
2025 S DUMPBELL AVE APT 317                               
FFFF4E4CEDDCCDD4CEC4CDE4FFF4444444444444444444444444444444
2025020444725330155017303170000000000000000000000000000000


I have to convert these trailing spaces of the field to low values.

1799 ARBYDALE LN..........................................
FFFF4CDCECCDC4DD000000000000000000000000000000000000000000
1799019284135035000000000000000000000000000000000000000000
 ---------------------------------------------------------
1234 HILTON WHITEMALL RD..................................
FFFF4CCDEDD4ECCECDCDD4DC0000000000000000000000000000000000
1234089336506893541330940000000000000000000000000000000000
 ---------------------------------------------------------
2025 S DUMPBELL AVE APT 317...............................
FFFF4E4CEDDCCDD4CEC4CDE4FFF0000000000000000000000000000000
2025020444725330155017303170000000000000000000000000000000


The length of different fields vary.
eg the above is an address line, similarly there could be a name in the same record, which also needs to fixed.

can we handle this via sort or fileaid

Thanks in advance.
akanchu
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Conversion from trailing spaces of text to low-values

Postby Alissa Margulies » Wed Jan 13, 2010 10:49 pm

Hello Akanchu.

Here is a sample SyncSort for z/OS 1.3.2 job tht will do what you asked:
//S1    EXEC PGM=SORT                                         
//SYSOUT  DD SYSOUT=*                                         
//SORTOUT DD DSN=OUTPUT.FILE                                   
//SORTIN  DD *                                                 
1799 ARBYDALE LN                                               
1234 HILTON WHITEMALL RD                                       
2025 S DUMPBELL AVE APT 317                                   
//SYSIN   DD *                                                 
  SORT FIELDS=COPY                                             
  OUTFIL IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(X'4040',X'0000'))),
         IFTHEN=(WHEN=(80,1,CH,EQ,X'40'),OVERLAY=(80:X'00'))   
/*                                                             
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: Conversion from trailing spaces of text to low-values

Postby akanchu » Thu Jan 14, 2010 12:20 am

Thanks Alissa.

just ran into trouble with that because we have "SYNCSORT FOR Z/OS 1.3.1.0R"
so it errored out on FINDREP... so close. :(

just out of curiosity and to understand FINREP :
if there is data starting at position 80, what will need to be done?
eg say like
1799 ARBYDALE LN                                                               Miami
1234 HILTON WHITEMALL RD                                                       Niagara
2025 S DUMPBELL AVE APT 317                                                    Buffalo

Also does FINDREP take care of the odd number(say 11 or 13) spaces.

Thanks
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Conversion from trailing spaces of text to low-values

Postby Alissa Margulies » Thu Jan 14, 2010 1:03 am

If you only want to change the trailing blanks to low values in the first field, then you can code the following:
//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(X'4040',X'0000'),
       STARTPOS=1,ENDPOS=79)),                             
       IFTHEN=(WHEN=(79,1,CH,EQ,X'40'),OVERLAY=(79:X'00'))

However, if you want to change the trailing blanks in both fields, the code can be modified as follows (assuming the second field is 10 bytes):
   
//SYSIN   DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTFIL IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(X'4040',X'0000'))),         
         IFTHEN=(WHEN=(79,1,CH,EQ,X'40'),OVERLAY=(79:X'00'),HIT=NEXT),
         IFTHEN=(WHEN=(89,1,CH,EQ,X'40'),OVERLAY=(89:X'00'))           
/*     
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: Conversion from trailing spaces of text to low-values

Postby akanchu » Thu Jan 14, 2010 11:44 am

Thanks Alissa.
So with this option, I will have to know the length of each field that may have trailing spaces, to take care of the last byte.
Do you think there is a work around to ignore the check for the last byte.
I guess, will have to do another round of sort to take care of them.


Since I cannot use the FINDREP option, I will wait for any input from anybody else.

Thanks for your help.
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Conversion from trailing spaces of text to low-values

Postby dick scherrer » Fri Jan 15, 2010 12:15 am

Hello,

If you need this any time soon, you could actually write a bit of code - which might take 15 minutes. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post