Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sorting input records on length of characters.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Dec 04, 2013 10:03 am    Post subject:
Reply with quote

Hi,

if I understand it correctly, you want the full name ie. first name initial and last name reversed and sorted with longest name first
ie. longest name=lastname + initial + first name

Code:
//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=input-file                             
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=(1,255,BI,D)                               
  INREC IFTHEN=(WHEN=INIT,                               
        PARSE=(%01=(ENDAT=X'40',FIXLEN=126),             
               %02=(ENDAT=X'40',FIXLEN=1),               
               %03=(ENDAT=X'40',FIXLEN=126)),             
             BUILD=(%03,C'?',%02,C'?',%01)),             
        IFTHEN=(WHEN=(1,1,CH,EQ,1,1,CH),                 
             BUILD=(1,255,SQZ=(SHIFT=RIGHT)))             
 OUTFIL IFOUTLEN=130,                                     
        IFTHEN=(WHEN=INIT,BUILD=(1,255,SQZ=(SHIFT=LEFT))),
        IFTHEN=(WHEN=INIT,                               
                FINDREP=(INOUT=(C'?',X'40')))             



Gerry
Back to top
View user's profile Send private message

ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Dec 04, 2013 4:31 pm    Post subject: Reply to: Sorting input records on length of characters.
Reply with quote

Gerry, thanks a lot.......you have made my day...... icon_biggrin.gif
Can you please help me why length is fixed at 126 when file's length is 130 ?
what does below do?
Code:

WHEN=(1,1,CH,EQ,1,1,CH)


Thanks again.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Wed Dec 04, 2013 6:40 pm    Post subject: Reply to: Sorting input records on length of characters.
Reply with quote

Ramsri,

I think Gerry was just showing an example, since you've kept any details to yourself.

You, surely, know what the maximum length of the elements of the name can be, and that gives you the theoretical maximum length needed. If your field already exists in that form (firstname, initial, lastname) only, then it is just the length of that field itself that you need to work with. The maximum length for an individual item for the FIXLEN is (field-length - 1 - 1 - 1 - 1). 130 seems a reasonable length, to guess, that would hold all your data, and may be much longer than need. You know your data, we don't.

The IFTHEN is just getting a "true", so is unconditional. I think another IFTHEN=(WHEN=INIT would be better.

I suggested JFY rather than SQZ due to the potential of embedded blanks in names. I assumed you had the rearrangement dealt with and were just keeping it a secret.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Dec 05, 2013 7:14 am    Post subject:
Reply with quote

Hi Ramsri,

Quote:
Can you please help me why length is fixed at 126 when file's length is 130 ?

With a file of LRECL=130, neither firstname or last name can exceed length of 126.

eq. firstname = 126 + 1 (space) + 1 (initial) +1 (space) + 1 (lastname)= 130, anything greater than 126 would exceed the input LRECL of 130.


Quote:
I suggested JFY rather than SQZ due to the potential of embedded blanks in names


If embedded blanks appeared in names, this process would not work.


Gerry
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Sun Dec 08, 2013 9:14 am    Post subject: Reply to: Sorting input records on length of characters.
Reply with quote

Thanks a lot Gerry.......it is always very interesting to learn technical things.
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 -> JCL & VSAM All times are GMT + 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File transfer issue with end of line ... VINAY PALLELA TSO/ISPF 4 Thu Nov 14, 2019 12:01 am
No new posts Sort to construct single record from ... Deepti_R SYNCSORT 3 Wed Nov 13, 2019 12:14 am
No new posts FTP - Special characters are converte... Chinnadu TSO/ISPF 2 Tue Nov 12, 2019 6:01 pm
No new posts DFSMShsm Dataset Recovery with B and ... Joerg.Findeisen JCL & VSAM 2 Sat Oct 05, 2019 10:01 pm
No new posts Duplicating records in a PDS memebr/I... imcoolleo COBOL Programming 5 Mon Sep 16, 2019 3:32 pm

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