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 PD to left justified number and pad sapces to right

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


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Mon Jan 08, 2007 4:53 pm    Post subject: Convert PD to left justified number and pad sapces to right Reply with quote

As a part of a requirement we are trying to Build a KSDS VSAM file from a Flat file. The Key of the VSAM which we are going to build is a combination of the following fields on flat file.

1) Account Number
2) Fund number

The Flat file has two record lay outs with the following definitions for the above fields

First record layout

1) Account number 9(10) COMP-3
2) Fund Number 9(5) Comp-3.

Fund number can have a value between 1 to 99999 in record lay out 1.

Second record lay out

1) Account number 9(10) COMP-3
2) Fund Number X(5).

Fund number can have a value between 1 to 99999 OR any other alpha numeric value in Record lay out 2.

Can I convert the fund number for record lay out 1 in the format of alphanumeric value using sort ?

To elaborate ...

If FUND NUMBER is X'00999C' I would like that to be changed to C'999BB '
If FUND NUMBER is X'09999C' I would like that to be changed to C'9999B'
If FUND NUMBER is X'00009C' I would like that to be changed to C'9BBBB'
(B - represents space in the above example.)

Can this be achieved using sort ?

Thanks
Novice
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jan 08, 2007 5:11 pm    Post subject: Reply with quote

Novice,

Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's NUM and JFY functions. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(7,3,PD,EQ,NUM),
    OVERLAY=(7:7,3,PD,TO=FS,LENGTH=5,
             7:7,5,JFY=(SHIFT=LEFT)))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Mon Jan 08, 2007 5:44 pm    Post subject: Reply with quote

Thanks Frank. I will run this and will let you know whether we have the required PTF's

Thanks
Nag
Back to top
View user's profile Send private message
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Tue Jan 09, 2007 9:26 pm    Post subject: Reply with quote

Hi Frank,

I checked up with our system folks and they confirmed that the PTF is not applied and will be done after few months as right now we have a 'Freeze Period' in place on production movement

So in the mean time is there any other way to achieve the same?

Thanks for your time.

Novice
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 10, 2007 12:08 pm    Post subject: Reply with quote

Hmmm... well, do you have the Dec, 2004 PTF? Try this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(5:C'A')
/*


and show me the //SYSOUT output.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Wed Jan 10, 2007 3:02 pm    Post subject: Reply with quote

It worked and here is the SYSOUT display


Code:

1ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                               
 ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
 ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 14:58 ON WED JA
0            OPTION COPY                                                       
             INREC OVERLAY=(5:C'A')                                             
 ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
 ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E9-K90007 C9-BASE   E5-K14794
 ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED   
 ICE088I 0 Q4X77JVA.STEP2   .        , INPUT LRECL = 550, BLKSIZE = 27500, TYPE
 ICE093I 0 MAIN STORAGE = (MAX,6291456,6291456)                                 
 ICE156I 0 MAIN STORAGE ABOVE 16MB = (6234096,6234096)                         
 ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y
 ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ER
 ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT
 ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT
 ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW
 ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXIT
 ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAM
 ICE235I 0 OPTIONS: NULLOUT=RC0                                                 
 ICE084I 0 EXCP ACCESS METHOD USED FOR SORTOUT                                 
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN                 
ICE751I 1 EF-K10929 F0-Q84357 E8-K11698                       
ICE090I 0 OUTPUT LRECL = 550, BLKSIZE = 27500, TYPE = FB     
ICE055I 0 INSERT 0, DELETE 0                                 
ICE054I 0 RECORDS - IN: 121, OUT: 121                         
ICE052I 0 END OF DFSORT                                       
[/quote]
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 10, 2007 4:14 pm    Post subject: Reply with quote

Novice,



try these control cards


Code:

//SYSIN    DD *
 SORT FIELDS=COPY
 INREC IFTHEN=(WHEN=(9,1,SS,EQ,X'0C1C2C3C4C5C6C7C8C9C'),
     OVERLAY=(7:7,3,PD,TO=FS,LENGTH=5))       

 OUTREC IFTHEN=(WHEN=(7,5,CH,EQ,C' '),
       OVERLAY=(7:C'0',4X)),
        IFTHEN=(WHEN=(7,4,CH,EQ,C' ',AND,11,1,CH,GT,C' '),
       OVERLAY=(7:11,1,4X)),
        IFTHEN=(WHEN=(7,3,CH,EQ,C' ',AND,10,1,CH,GT,C' '),
       OVERLAY=(7:10,2,3X)),
        IFTHEN=(WHEN=(7,2,CH,EQ,C' ',AND,09,1,CH,GT,C' '),
       OVERLAY=(7:09,3,2X)),
        IFTHEN=(WHEN=(7,1,CH,EQ,C' ',AND,08,1,CH,GT,C' '),
       OVERLAY=(7:08,4,X)),
        IFTHEN=(WHEN=NONE,
       OVERLAY=(7:7,5))
/*


Hope this helps...

Cheers

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 10, 2007 4:38 pm    Post subject: Reply with quote

I forgot to ask - what is the RECFM and LRECL of the input file?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 10, 2007 4:43 pm    Post subject: Reply with quote

Kolusu,

I was working on something similar, but I think the input file may be VB.

For the WHEN condition, it's easier to use:

WHEN=(9,1,BI,EQ,B'....1100')
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Fri Jan 19, 2007 12:08 pm    Post subject: Reply with quote

Thanks Kolusu and Frank. Sorry for responding late, as I was on a vacation.

The solution worked and thanks once again for your help

Novice
Back to top
View user's profile Send private message
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