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 

SORT-: Convert a field from usage display to Comp-3

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


Joined: 29 Nov 2003
Posts: 68
Topics: 14

PostPosted: Fri Apr 15, 2005 1:30 pm    Post subject: SORT-: Convert a field from usage display to Comp-3 Reply with quote

My input file looks like this.

Code:

----+----1----+----2----+----3----+----4----+----5----
********************************* Top of Data ********
HALLAHALLMARK ORIG FEE   VOL+0000000000000.00+0.001850
CDW ACDW ORIG FEES       OEC+0000000000000.00+0.002500
CHDNMTOSH CHILD HOSP RES OEC+0000000000000.00+0.002500
APRPAAPPLE RATE PAR      VOL+0000000000000.00+0.002500
CHNLACHANNEL TOP LIST    VOL+0000000000000.00+0.002500
IBMOAIBM OUT ORIG FEES   VOL+0000000000000.00+0.002500



What matters to me is AMT starting position 29 and PCT starting position 46. I need to get these fields converted into
AMT PIC S9(13)V99. (Amount will not be comp-3)
PCT PIC S9V9(6) COMP-3. for a database load job.

Could you please tell me a SORT solution for this ?
_________________
Regards,
Shivprakash
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Apr 15, 2005 2:00 pm    Post subject: Reply with quote

Shiv_swami,

Try this

Code:

//SYSIN    DD *                                     
 SORT FIELDS=COPY                                   
 INREC FIELDS=(01,28,   $ FIRST 28 BYTES           
               29,14,   $ AMT PORTION BEFORE DECIMAL
               44,2,    $ DEC PORTION IN AMT       
               46,2,    $ PCT PORTION BEFORE DECIMAL
               49,6)    $ DEC PORTION IN PCT       
 OUTREC FIELDS=(1,28,                               
               29,16,FS,PD,LENGTH=8,               
               45,8,FS,PD,LENGTH=4)                 
/*   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/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: Fri Apr 15, 2005 3:26 pm    Post subject: Reply with quote

Quote:
AMT PIC S9(13)V99. (Amount will not be comp-3)
PCT PIC S9V9(6) COMP-3. for a database load job.


So the AMT value should be a 15-byte ZD value and the PCT value should be 4-byte PD value.

With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can use DFSORT's new SFF (signed free form) format to do this quite easily. If you have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free).

Here's the DFSORT job. It wasn't clear where you wanted the converted values in the output record or what length you wanted for the output records, but the job can be changed appropriately depending on what you want.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
HALLAHALLMARK ORIG FEE   VOL+0000000000000.00+0.001850
CDW ACDW ORIG FEES       OEC+0000000000000.00+0.002500
CHDNMTOSH CHILD HOSP RES OEC+0000000000000.00+0.002500
APRPAAPPLE RATE PAR      VOL+0000000000000.00+0.002500
CHNLACHANNEL TOP LIST    VOL+0000000000000.00+0.002500
IBMOAIBM OUT ORIG FEES   VOL+0000000000000.00+0.002500
/*
//SORTOUT DD DSN=...  output file
//SYSIN    DD *
 SORT FIELDS=COPY
 INREC FIELDS=(1,28,
               29:29,17,SFF,TO=ZD,LENGTH=15,
               44:46,9,SFF,TO=PD,LENGTH=4)
/*

_________________
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
shiv_swami
Beginner


Joined: 29 Nov 2003
Posts: 68
Topics: 14

PostPosted: Mon Apr 18, 2005 9:48 am    Post subject: Reply with quote

Thanks very much for the solutions.

Kolusu,
Your solution works great.

Frank,
We do not have DFSORT at our installation. (Neither do I have influence Sad over the procedure of product selection.) So I cannot use DFSORT solution.
_________________
Regards,
Shivprakash
Back to top
View user's profile Send private message Yahoo Messenger
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