Joined: 09 Dec 2003 Posts: 2 Topics: 1 Location: Chennai
Posted: Thu Jun 24, 2004 8:25 pm Post subject: Sort card to initialize numeric fields with zeros
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.
Joined: 15 May 2004 Posts: 17 Topics: 2 Location: Mumbai , India
Posted: Fri Jun 25, 2004 12:22 am Post subject:
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
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Fri Jun 25, 2004 5:03 am Post subject:
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)
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:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jun 25, 2004 10:05 am Post subject:
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:
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