MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Right Justify a field using SYNCSORT/File-Aid.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Apr 19, 2006 6:06 am    Post subject: Right Justify a field using SYNCSORT/File-Aid. Reply with quote

Hi,

I have a dataset with content shown as following.

Code:

***************************** Top of Data ******************************
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
1234 AAAA             1AXAASKLFJKLASFR20394023402340230AFXCLLASDFL03933
**************************** Bottom of Data ****************************


I want to right jusity the "AAAA" (not only this but several other records) while copying it to output dataset.

Code:

***************************** Top of Data ******************************
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
1234             AAAA 1AXAASKLFJKLASFR20394023402340230AFXCLLASDFL03933
**************************** Bottom of Data ****************************


How to do it using the SYNCSORT/File-Aid.

Please post both the solutions if you have idea. TIA.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Apr 19, 2006 7:39 am    Post subject: Reply with quote

mf_user,

Please search before posting. This topic has been discussed earlier.

http://www.mvsforums.com/helpboards/viewtopic.php?t=5185&highlight=pad

The above link shows padding zeroes to the left of the field. you can change it to pad spaces to the left.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Apr 19, 2006 8:04 am    Post subject: Reply with quote

Kolusu, Thanks a lot. It seems to be a very difficult task. I need to be very careful while modifying the solution provided by you to suit my requirement..... Rolling Eyes

If I won't succeed then I will go for a COBOL program........ 8)

Thanks a lot.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Apr 19, 2006 8:25 am    Post subject: Reply with quote

Try this.

I assumed that your input file has an lrecl of 80 bytes and FB recfm. I also assumed that the field in question is 16 bytes.


Code:

//STEP0100 EXEC PGM=SYNCTOOL       
//TOOLMSG  DD SYSOUT=*           
//DFSMSG   DD SYSOUT=*           
//IN       DD *                   
1200                  1AXAASKLFJKL
1201 A                1AXAASKLFJKL
1202 BB               1AXAASKLFJKL
1203 CCC              1AXAASKLFJKL
1204 DDDD             1AXAASKLFJKL
1205 EEEEE            1AXAASKLFJKL
1206 FFFFFF           1AXAASKLFJKL
1207 GGGGGGG          1AXAASKLFJKL
1208 HHHHHHHH         1AXAASKLFJKL
1209 IIIIIIIII        1AXAASKLFJKL
1210 JJJJJJJJJJ       1AXAASKLFJKL
1211 KKKKKKKKKKK      1AXAASKLFJKL
1212 LLLLLLLLLLLL     1AXAASKLFJKL
1213 MMMMMMMMMMMMM    1AXAASKLFJKL
1214 NNNNNNNNNNNNNN   1AXAASKLFJKL
1215 OOOOOOOOOOOOOOO  1AXAASKLFJKL
1216 PPPPPPPPPPPPPPPP 1AXAASKLFJKL
//T00      DD DSN=&T00,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T01      DD DSN=&T01,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T02      DD DSN=&T02,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T03      DD DSN=&T03,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T04      DD DSN=&T04,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T05      DD DSN=&T05,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T06      DD DSN=&T06,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T07      DD DSN=&T07,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T08      DD DSN=&T08,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T09      DD DSN=&T09,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T10      DD DSN=&T10,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T11      DD DSN=&T11,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T12      DD DSN=&T12,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T13      DD DSN=&T13,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T14      DD DSN=&T14,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T15      DD DSN=&T15,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T16      DD DSN=&T16,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//CON      DD DSN=*.T00,VOL=REF=*.T00,DISP=OLD           
//         DD DSN=*.T01,VOL=REF=*.T01,DISP=OLD           
//         DD DSN=*.T02,VOL=REF=*.T02,DISP=OLD           
//         DD DSN=*.T03,VOL=REF=*.T03,DISP=OLD           
//         DD DSN=*.T04,VOL=REF=*.T04,DISP=OLD           
//         DD DSN=*.T05,VOL=REF=*.T05,DISP=OLD           
//         DD DSN=*.T06,VOL=REF=*.T06,DISP=OLD           
//         DD DSN=*.T07,VOL=REF=*.T07,DISP=OLD           
//         DD DSN=*.T08,VOL=REF=*.T08,DISP=OLD           
//         DD DSN=*.T09,VOL=REF=*.T09,DISP=OLD           
//         DD DSN=*.T10,VOL=REF=*.T10,DISP=OLD           
//         DD DSN=*.T11,VOL=REF=*.T11,DISP=OLD           
//         DD DSN=*.T12,VOL=REF=*.T12,DISP=OLD           
//         DD DSN=*.T13,VOL=REF=*.T13,DISP=OLD           
//         DD DSN=*.T14,VOL=REF=*.T14,DISP=OLD           
//         DD DSN=*.T15,VOL=REF=*.T15,DISP=OLD           
//         DD DSN=*.T16,VOL=REF=*.T16,DISP=OLD           
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                                     
  COPY FROM(IN)  USING(CTL1)                                       
  SORT FROM(CON) USING(CTL2)                                       
//CTL1CNTL DD *                                                     
  OUTREC FIELDS=(1,80,SEQNUM,8,ZD)                                 
  OUTFIL FNAMES=T01,INCLUDE=(07,15,CH,EQ,C' ',AND,06,01,CH,NE,C' '),
  OUTREC=(01,05,15Z,06,01,22,67)                                   
  OUTFIL FNAMES=T02,INCLUDE=(08,14,CH,EQ,C' ',AND,07,01,CH,NE,C' '),
  OUTREC=(01,05,14Z,06,02,22,67)                                   
  OUTFIL FNAMES=T03,INCLUDE=(09,13,CH,EQ,C' ',AND,08,01,CH,NE,C' '),
  OUTREC=(01,05,13Z,06,03,22,67)                                   
  OUTFIL FNAMES=T04,INCLUDE=(10,12,CH,EQ,C' ',AND,09,01,CH,NE,C' '),
  OUTREC=(01,05,12Z,06,04,22,67)                                   
  OUTFIL FNAMES=T05,INCLUDE=(11,11,CH,EQ,C' ',AND,10,01,CH,NE,C' '),
  OUTREC=(01,05,11Z,06,05,22,67)                                   
  OUTFIL FNAMES=T06,INCLUDE=(12,10,CH,EQ,C' ',AND,11,01,CH,NE,C' '),
  OUTREC=(01,05,10Z,06,06,22,67)                                   
  OUTFIL FNAMES=T07,INCLUDE=(13,09,CH,EQ,C' ',AND,12,01,CH,NE,C' '),
  OUTREC=(01,05,09Z,06,07,22,67)                                   
  OUTFIL FNAMES=T08,INCLUDE=(14,08,CH,EQ,C' ',AND,13,01,CH,NE,C' '),
  OUTREC=(01,05,08Z,06,08,22,67)                                   
  OUTFIL FNAMES=T09,INCLUDE=(15,07,CH,EQ,C' ',AND,14,01,CH,NE,C' '),
  OUTREC=(01,05,07Z,06,09,22,67)                                   
  OUTFIL FNAMES=T10,INCLUDE=(16,06,CH,EQ,C' ',AND,15,01,CH,NE,C' '),
  OUTREC=(01,05,06Z,06,10,22,67)                                   
  OUTFIL FNAMES=T11,INCLUDE=(17,05,CH,EQ,C' ',AND,16,01,CH,NE,C' '),
  OUTREC=(01,05,05Z,06,11,22,67)                                   
  OUTFIL FNAMES=T12,INCLUDE=(18,04,CH,EQ,C' ',AND,17,01,CH,NE,C' '),
  OUTREC=(01,05,04Z,06,12,22,67)                                   
  OUTFIL FNAMES=T13,INCLUDE=(19,03,CH,EQ,C' ',AND,18,01,CH,NE,C' '),
  OUTREC=(01,05,03Z,06,13,22,67)                                   
  OUTFIL FNAMES=T14,INCLUDE=(20,02,CH,EQ,C' ',AND,19,01,CH,NE,C' '),
  OUTREC=(01,05,02Z,06,14,22,67)                                   
  OUTFIL FNAMES=T15,INCLUDE=(21,01,CH,EQ,C' ',AND,20,01,CH,NE,C' '),
  OUTREC=(01,05,01Z,06,15,22,67)                                   
  OUTFIL FNAMES=T00,SAVE                                           
//CTL2CNTL DD *                     
  SORT FIELDS=(81,8,CH,A)           
  SUM FIELDS=(06,08,14,08),FORMAT=BI
  OUTFIL FNAMES=OUT,                 
  OUTREC=(1,80)                     
/*                                   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Apr 19, 2006 11:20 pm    Post subject: Reply with quote

Kolusu,

Thanks for you extreme help. Actually, I solved the problem like explained below:

I declared the record layout in the WS and I declared a variable with "RIGHT JUSTIFIED". I kept the first and last bytes as filler and moved the entire record to this new structure and rewritten the output file by opening the file in I-O mode. I know that this is only temporary solution what I've worked out. The reason behind that was because I get the characters as "AAAA" or "BBBB" or "CCCC" like that. So, it made my work easier.

One more solution I found was making use of REVERSE function available in COBOL. This has also worked for me because my incoming data has repetitive characters.

Please let me know if my approach was wrong.

Once again thanks for your help buddy.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Apr 19, 2006 11:24 pm    Post subject: Reply with quote

I got what would be the limitation of the solution I've worked out. It does not work for the fields defined as Numeric data items. In this case the solution and links provided by KOLUSU will be very handy for anybody.

Please let me know if my understanding is wrong.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Apr 19, 2006 11:48 pm    Post subject: Reply with quote

Hi,

Is this feat possible with File-Aid? Any hints?

TIA.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 20, 2006 7:34 am    Post subject: Reply with quote

mf_user,

Try this. I haven't tested it though so excuse me if there are any syntax errors.

Code:

//STEP0100 EXEC PGM=FILEAID             
//SYSPRINT DD  SYSOUT=*                 
//SYSLIST  DD  SYSOUT=*                 
//DD01     DD  *                       
1200                  1AXAASKLFJKL     
1201 A                1AXAASKLFJKL     
1202 BB               1AXAASKLFJKL     
1203 CCC              1AXAASKLFJKL     
1204 DDDD             1AXAASKLFJKL     
1205 EEEEE            1AXAASKLFJKL     
1206 FFFFFF           1AXAASKLFJKL     
1207 GGGGGGG          1AXAASKLFJKL     
1208 HHHHHHHH         1AXAASKLFJKL     
1209 IIIIIIIII        1AXAASKLFJKL     
1210 JJJJJJJJJJ       1AXAASKLFJKL     
1211 KKKKKKKKKKK      1AXAASKLFJKL     
1212 LLLLLLLLLLLL     1AXAASKLFJKL     
1213 MMMMMMMMMMMMM    1AXAASKLFJKL     
1214 NNNNNNNNNNNNNN   1AXAASKLFJKL     
1215 OOOOOOOOOOOOOOO  1AXAASKLFJKL     
1216 PPPPPPPPPPPPPPPP 1AXAASKLFJKL     
//OUTPUT   DD  SYSOUT=*                 
//SYSIN    DD  *                                     
$$DD01 USER MOVE=(01,80C' '),                       
    IF=(06,EQ,C'                '),                 
       MOVE=(01,80,01),WRITE=OUTPUT,                 
    IF=(07,EQ,C'               '),AND=(06,NE,C' '), 
       MOVE=(01,05,01),                             
       MOVE=(+0,15C' '),                             
       MOVE=(+0,01,06),                             
       MOVE=(+0,59,22),WRITE=OUTPUT,                 
    IF=(08,EQ,C'              '),AND=(07,NE,C' '),   
       MOVE=(01,05,01),                             
       MOVE=(+0,14C' '),                             
       MOVE=(+0,02,06),                             
       MOVE=(+0,59,22),WRITE=OUTPUT,                 
    IF=(09,EQ,C'             '),AND=(08,NE,C' '),   
       MOVE=(01,05,01),                             
       MOVE=(+0,13C' '),                             
       MOVE=(+0,03,06),                             
       MOVE=(+0,59,22),WRITE=OUTPUT,                 
    IF=(10,EQ,C'            '),AND=(09,NE,C' '),     
       MOVE=(01,05,01),                             
       MOVE=(+0,12C' '),                             
       MOVE=(+0,04,06),                             
       MOVE=(+0,59,22),WRITE=OUTPUT,                 
    IF=(11,EQ,C'           '),AND=(10,NE,C' '),     
       MOVE=(01,05,01),                             
       MOVE=(+0,11C' '),                             
       MOVE=(+0,05,06),                             
       MOVE=(+0,59,22),WRITE=OUTPUT,                 
    IF=(12,EQ,C'          '),AND=(11,NE,C' '),       
       MOVE=(01,05,01),                             
       MOVE=(+0,10C' '),                             
       MOVE=(+0,06,06),                             
       MOVE=(+0,59,22),WRITE=OUTPUT,                 
    IF=(13,EQ,C'         '),AND=(12,NE,C' '),     
       MOVE=(01,05,01),                           
       MOVE=(+0,09C' '),                         
       MOVE=(+0,07,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(14,EQ,C'        '),AND=(13,NE,C' '),     
       MOVE=(01,05,01),                           
       MOVE=(+0,08C' '),                         
       MOVE=(+0,08,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(15,EQ,C'       '),AND=(14,NE,C' '),       
       MOVE=(01,05,01),                           
       MOVE=(+0,07C' '),                         
       MOVE=(+0,09,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(16,EQ,C'      '),AND=(15,NE,C' '),       
       MOVE=(01,05,01),                           
       MOVE=(+0,06C' '),                         
       MOVE=(+0,10,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(17,EQ,C'     '),AND=(16,NE,C' '),         
       MOVE=(01,05,01),                           
       MOVE=(+0,05C' '),                         
       MOVE=(+0,11,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(18,EQ,C'    '),AND=(17,NE,C' '),         
       MOVE=(01,05,01),                           
       MOVE=(+0,04C' '),                         
       MOVE=(+0,12,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(19,EQ,C'   '),AND=(18,NE,C' '),           
       MOVE=(01,05,01),                           
       MOVE=(+0,03C' '),                         
       MOVE=(+0,13,06),                           
       MOVE=(+0,59,22),WRITE=OUTPUT,             
    IF=(20,EQ,C'  '),AND=(19,NE,C' '),     
       MOVE=(01,05,01),                   
       MOVE=(+0,02C' '),                   
       MOVE=(+0,14,06),                   
       MOVE=(+0,59,22),WRITE=OUTPUT,       
    IF=(21,EQ,C' '),AND=(20,NE,C' '),     
       MOVE=(01,05,01),                   
       MOVE=(+0,01C' '),                   
       MOVE=(+0,15,06),                   
       MOVE=(+0,59,22),WRITE=OUTPUT,       
    IF=(22,EQ,C' '),AND=(21,NE,C' '),     
       MOVE=(01,80,01),WRITE=OUTPUT       
/*                                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Apr 20, 2006 8:03 am    Post subject: Reply with quote

Ok Kolusu. I will test it and come back to you.

Thanks for your effort.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Apr 26, 2006 3:22 pm    Post subject: Reply with quote

I know the request here was for a Syncsort or FileAid solution, but the new JFY function of DFSORT available with the April, 2006 PTFs make this so much easier to do with DFSORT, that I couldn't resist showing that solution:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(6:6,16,JFY=(SHIFT=RIGHT))
/*


For complete information on all of the new DFSORT/ICETOOL functions available with the DFSORT April, 2006 PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Apr 26, 2006 11:59 pm    Post subject: Reply with quote

Thanks Kolusu. It worked.

Alas, why we don't have DFSORT !!
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group