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 

Convert Character field to ZD

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Tue Dec 30, 2003 10:46 am    Post subject: Convert Character field to ZD Reply with quote

Hi,
Is it possible to convert CH field to ZD using SYNCSORT ?. I have a file
with length 1000 and a field at position 13 with length 5 and format CH.The field is having trailing spaces.So when I sort this key field the output records are not following the expected sequence. Do I need to convert this field to ZD before sorting or is there any turaround? Pl advice..
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Dec 30, 2003 11:19 am    Post subject: Reply with quote

Somu,

I don't think conversion to ZD fields will solve the problem. Since you have trailing spaces, you need to format them to either right align or left align. since the field length is only 5 we can easily reformat it and then sort it.

As always please post a sample input data and expected output.

Thanks,

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Jan 02, 2004 3:14 pm    Post subject: Reply with quote

Kolusu,
Sorry for the belated reply. key field at 13 ,5,CH

Input file FB. rec length = 1000
------------------------------------
AAAAAAAA BB 2
AAAAAAAA BB 999
AAAAAAAA BB 10001
AAAAAAAA BB 794
AAAAAAAA BB 800
AAAAAAAA BB 10002

Output file FB.rec length = 1000
------------------------------------
AAAAAAAA BB 2
AAAAAAAA BB 794
AAAAAAAA BB 800
AAAAAAAA BB 999
AAAAAAAA BB 10001
AAAAAAAA BB 10002
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Jan 04, 2004 11:57 am    Post subject: Reply with quote

Somu,

The following JCL will give you the desired results. A brief explanation of the job. The first copy operator splits the input file into 5 temp files based on the no: of spaces on each record in the field in question(13,5). While splitting we also right align the field so that the sorting on the field will give the desired results. The second copy operator will combine all the 5 temp files and sort on the field in question. I haven't tested it, so bear with me for any syntax errors.

Code:

//STEP0100  EXEC PGM=SYNCTOOL                             
//TOOLMSG   DD SYSOUT=*                                   
//DFSMSG    DD SYSOUT=*                                   
//IN        DD *                                           
AAAAAAAA BB 2                                             
AAAAAAAA BB 999                                           
AAAAAAAA BB 10001                                         
AAAAAAAA BB 794                                           
AAAAAAAA BB 800                                           
AAAAAAAA BB 10002                                         
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T2        DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T3        DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T4        DD DSN=&T4,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T5        DD DSN=&T5,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//CON       DD DSN=&T1,DISP=OLD,VOL=REF=*.T1
//          DD DSN=&T2,DISP=OLD,VOL=REF=*.T2
//          DD DSN=&T3,DISP=OLD,VOL=REF=*.T3
//          DD DSN=&T4,DISP=OLD,VOL=REF=*.T4
//          DD DSN=&T5,DISP=OLD,VOL=REF=*.T5
//OUT       DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//TOOLIN    DD *                                                 
  COPY FROM(IN) USING(CTL1)                                       
  SORT FROM(CON) TO(OUT) USING(CTL2)                             
//CTL1CNTL  DD *                                                 
  OUTFIL FNAMES=T1,INCLUDE=(17,1,CH,EQ,C' ',AND,16,1,CH,NE,C' '),
  OUTREC=(1,12,X,13,4,18,983)                                     
  OUTFIL FNAMES=T2,INCLUDE=(16,2,CH,EQ,C' ',AND,15,1,CH,NE,C' '),
  OUTREC=(1,12,2X,13,3,18,983)                                     
  OUTFIL FNAMES=T3,INCLUDE=(15,3,CH,EQ,C' ',AND,14,1,CH,NE,C' '),
  OUTREC=(1,12,3X,13,2,18,983)                                     
  OUTFIL FNAMES=T4,INCLUDE=(14,4,CH,EQ,C' ',AND,13,1,CH,NE,C' '),
  OUTREC=(1,12,4X,13,1,18,983)                                     
  OUTFIL FNAMES=T5,SAVE                                           
//CTL2CNTL  DD *                                                 
  SORT FIELDS=(13,5,CH,A)                                         
/*


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
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Tue Jan 06, 2004 3:11 pm    Post subject: Reply with quote

Thanks Kolusu.
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
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