IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Convert Upper case to Title case


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gururajan Balaji

New User


Joined: 10 Jan 2011
Posts: 6
Location: Chennai

PostPosted: Fri Feb 18, 2011 11:55 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Feb 18, 2011 10:59 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 18, 2011 11:49 pm
Reply with quote

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
View user's profile Send private message
Gururajan Balaji

New User


Joined: 10 Jan 2011
Posts: 6
Location: Chennai

PostPosted: Mon Feb 21, 2011 5:40 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Feb 21, 2011 6:16 pm
Reply with quote

look at the literals in the inout card. there is a space before each letter.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top