Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Convert Upper case to Title case

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Convert Upper case to Title case
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    Post subject:
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 Moderator


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

PostPosted: Fri Feb 18, 2011 11:49 pm    Post subject:
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Mon Feb 21, 2011 6:16 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts RFE: DB2 support for mixed case names. Pedro DB2 0 Tue Jul 04, 2017 1:32 am
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us