|
View previous topic :: View next topic
|
| Author |
Message |
Gururajan Balaji
New User

Joined: 10 Jan 2011 Posts: 6 Location: Chennai
|
|
|
|
Hi,
I have an input file of length 20 and RECFM = FB.
Input file will look as mentioned below.
Sample Input: RECFM = FB/LRECL=20
| Code: |
MEGA CONSTRUCTION
EUROPEAN INVESTMENT
ARB SILICON INC
|
i would like to convert the upper case words to Title case (i,e) only the first letter of each word should be in upper case and rest of the letters should be in lower case.
Sample Output: RECFM = FB/LRECL=20
| Code: |
Mega Construction
European Investment
Arb Silicon Inc
|
Please let me know if this can be achieved using DFSORT.
Thanks & Regards,
Balaji G |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Gururajan Balaji,
Use the following DFSORT JCL which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(2:2,19,TRAN=UTOL)
OUTREC FINDREP=(STARTPOS=2,
INOUT=(C' a',C' A',C' b',C' B',C' c',C' C',C' d',C' D',
C' e',C' E',C' f',C' F',C' g',C' G',C' h',C' H',
C' i',C' I',C' j',C' J',C' k',C' K',C' l',C' L',
C' m',C' M',C' n',C' N',C' o',C' O',C' p',C' P',
C' q',C' Q',C' r',C' R',C' s',C' S',C' t',C' T',
C' u',C' U',C' v',C' V',C' w',C' W',C' x',C' X',
C' y',C' Y',C' z',C' Z'))
//* |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Gururajan Balaji,
FYI, here's another way to do it with DFSORT. I assumed each record could have a maximum of three words (although the technique could be extended to more):
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(ENDBEFR=C' ',FIXLEN=20),
%02=(ENDBEFR=C' ',FIXLEN=20),
%03=(FIXLEN=20)),
BUILD=(%01,TRAN=UTOL,%02,TRAN=UTOL,%03,TRAN=UTOL)),
IFTHEN=(WHEN=INIT,
OVERLAY=(1:1,1,TRAN=LTOU,
21:21,1,TRAN=LTOU,
41:41,1,TRAN=LTOU)),
IFTHEN=(WHEN=INIT,
BUILD=(1,60,SQZ=(SHIFT=LEFT,MID=C' ',LENGTH=20)))
|
|
|
| Back to top |
|
 |
Gururajan Balaji
New User

Joined: 10 Jan 2011 Posts: 6 Location: Chennai
|
|
|
|
Thanks Kolusu & Frank. It works...
Kolusu Could you please explain your logic. As per my understanding the FINDREP is supposed to replace all the lower case alphabets to upper cas e alphabets starting from position 2. But the sort card replaces the lower case to upper case only if it is a first letter of the word. How is this achieved?
Thanks Once again. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| look at the literals in the inout card. there is a space before each letter. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|