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 card to initialize numeric fields with zeros

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


Joined: 09 Dec 2003
Posts: 2
Topics: 1
Location: Chennai

PostPosted: Thu Jun 24, 2004 8:25 pm    Post subject: Sort card to initialize numeric fields with zeros Reply with quote

Hi Friends,

I have expanded a file of LRECL=400 to LRECL=528. I want to initialize all numeric fields with zeros. The data types of all the numeric fields are different. Could some one give me the sort card, to initialize the following structure.

05 STRUCTURE 1- 400 ----------- PIC X(400).
05 New-Data.
10 filler ----------- PIC X(01).
10 DOB ----------- PIC 9(08.
10 Numeric ----------- PIC S9(05).
10 filler ----------- PIC X(02).
10 HOURLY-WAGE ----------- PIC 9(03)V99.
10 MONTHLY-BENEFITS ----------- PIC S9(05)V99.
05 Filler ----------- PIC X(100).

Thanks for your help in advance.

Regards,
Raya
Back to top
View user's profile Send private message
souvik_225
Beginner


Joined: 15 May 2004
Posts: 17
Topics: 2
Location: Mumbai , India

PostPosted: Fri Jun 25, 2004 12:22 am    Post subject: Reply with quote

If this is a COBOL program in which u have defined this , then use the VALUE clause to intialize the variables(do it if this is in the working storage only and not FD section) ....

for runtime initialization , use INITIALIZE New-data.

BTW , how are u initializing STRUCTURE ???
_________________
Thanks and Regards,
Souvik Upadhyay
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 Jun 25, 2004 5:03 am    Post subject: Reply with quote

Ratanraya,

Assuming that your input file is 400 bytes and you want to expand it to 528 bytes then the following JCL will give you the desired results.

DOB, NUMERIC, HOURLY-WAGE, MONTHLY-BENEFITS are all numeric fields which are of ZD format in sort. To initialize them you just populate them with zeroes.

DOB starts at pos 402 for 8 bytes which of zd format. To initialize it we code 8c'0'
NUMERIC starts at pos 410 for 5 bytes which of ZD format. To initialize it we code 5c'0'
HOURLY-WAGE starts at pos 417 for 5 bytes which is of ZD format. To initialize it we code 5c'0'
MONTHLY-BENEFITS starts at pos 422 for 7 bytes which is of ZD format. To initialize it we code 7c'0'

I have initialized the filler values with spaces(x)

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=YOUR 400 BYTE FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR 528 BYTE EXPANDED FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTREC FIELDS=(001,400,         $ FIRST 400 BYTES FROM INPUT FILE
                 X,               $ FILLER = SPACE
                 8C'0',           $ DOB WITH ZEROES
                 5C'0',           $ NUMERIC WITH ZEROES
                 2X,              $ FILLER = 2 SPACES
                 5C'0',           $ HOURLY WAGE WITH ZEROES
                 7C'0',           $ MONTHLY BENEFIT WITH ZEROES
                 100X)            $ FILLER = 100 SPACES
/*


For equivalent DFSORT formats for various COBOL data types, see the "What are the equivalent DFSORT formats for various COBOL data types?" Ask Professor Sort item at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/


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 Jun 25, 2004 10:05 am    Post subject: Reply with quote

Note that if you have DFSORT R14 PTF UQ90053 (Feb, 2003), you can use INREC, OUTREC or OUTFIL OUTREC to initialize any field to zeros of the correct format as follows:

Code:

+0,TO=f,LENGTH=n


So instead of 8C'0' for 8 ZD zeros, you could code +0,TO=ZD,LENGTH=8. For 4 bytes of PD zeros, you could code +0,TO=PD,LENGTH=4 instead of X'0000000C'. And so on. This is a more consistent way of specifying the correct type of zeros than using character or hex constants. And you don't have to worry about what the constant needs to look like since DFSORT figures it out for you.

For complete information on DFSORT's arithmetic expressions and decimal constants, see:

http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmurfm.html#exp
_________________
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
rathanraya
Beginner


Joined: 09 Dec 2003
Posts: 2
Topics: 1
Location: Chennai

PostPosted: Tue Jul 06, 2004 12:35 pm    Post subject: Reply with quote

Hi Kolusu & Frank,

Sorry for late reply
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