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 

summing Cobol pic 9(9) data using sort.

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


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Thu Mar 11, 2004 5:15 am    Post subject: summing Cobol pic 9(9) data using sort. Reply with quote

Hi Gurus

We use DFSORT in our system. I have a simple requirement.

Sum particular columns based on certain sort criteria.
My columns has the picture attribute...i.e., PIC 9(9).

From the manuals I have read I understand format can be only of the types:
BI = unsigned binary (2, 4 or 8 bytes)
FI = signed fixed-point (2, 4 or 8 bytes)
PD = signed packed decimal (1 to 16 bytes)
ZD = signed zoned decimal (1 to 18 bytes)

Now, is there a way I can add the PIC 9(9) column using sort. Please let me know.

Regards,
Relaxing....
Back to top
View user's profile Send private message
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Thu Mar 11, 2004 5:54 am    Post subject: Reply with quote

Hi Ravi

Guess I was not clear.
My columns to be added have the picture clause PIC 9(9). Sorting is not a problem.

It is this..

//SYSIN DD *
SORT FIELDS=(1,15,CH,A)
SUM FIELDS=(16,9),FORMAT=????? (As here I have the column as PIC9(9).
/*
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Mar 11, 2004 6:27 am    Post subject: Reply with quote

Relaxing,

Frank made it easy for you. 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/

You need to use ZD Format for your summing.

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
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Thu Mar 11, 2004 7:32 am    Post subject: Reply with quote

Hi Kolusu/Ravi

Thanks for the support. How about PL1. Do we have something similar.

This is the input:

2001FZ010007024000000018000000036
2001FZ010007024000000000000000000

I get this as the output:
2001FZ01000702400000001H00000003F

My sysin statements were:

//SYSIN DD *
SORT FIELDS=(1,15,CH,A)
SUM FIELDS=(16,9,25,9),FORMAT=ZD
/*

Originally this column "000000018" (and the next) were built this way:

5 JAN_DEMAND CHAR(09),

DCL W_DEMAND PIC '(9)9' INIT (0);
DCL 1 W_DEMAND_CHAR BASED(ADDR(W_DEMAND)),
2 W_DEMAND_CHAR_S CHAR(09) INIT('');

5 QY_HIST FIXED DEC(0009,00),

1. QY_HIST = W_DEMAND;
2. JAN_DEMAND = W_DEMAND_CHAR_S

Regards,
Relaxing
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Mar 11, 2004 9:04 am    Post subject: Reply with quote

Relaxing,

It has been a while that I worked on PLI. Let me see if I can remember them correctly.

CHAR is equivalent to cobol PIC X(N).

BIN FIXED(p) where p is in the range 1 to 15 is equivalent to cobol s9(4) comp.

BIN FIXED(p) where p is in the range 16 to 31 is equivalent to cobol s9(9) comp.

DEC FIXED(p) or DEC FIXED(p,s) or PICTURE picture-string is equivalent to comp-3 items.

BIN FLOAT(p) p is in the range 1 to 24 is equivalent to cobol COMP-1

BIN FLOAT(p) p is in the range 25 to 53 is equivalent to cobol COMP-2

DEC FLOAT(m) m is in the range 1 to 7 is equivalent to cobol COMP-1

DEC FLOAT(m) m is in the range 8 to 16 is equivalent to cobol COMP-2

Now you can cross reference the pli data-items to the dfsort data types.

Frank can you also add equivalent DFSORT formats for various PLI data types ?

Thanks,

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: Thu Mar 11, 2004 12:35 pm    Post subject: Reply with quote

Relaxing,

If you want the result of the ZD sums to be:

2001FZ010007024000000018000000036

instead of:

2001FZ01000702400000001H00000003F

just add the following to your DFSORT statements:

Code:

   OPTION ZDPRINT


ZDPRINT tells DFSORT to use an F sign for ZD sums instead of a C sign (both are valid plus signs for ZD).
_________________
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: Thu Mar 11, 2004 12:39 pm    Post subject: Reply with quote

Kolusu,

The IBM COBOL guru helped me work out the COBOL table. I don't know PL/I well enough to come up with a comprehensive table for PL/I vs DFSORT formats. If you can create such a table and send it to me, I will see if I can get it verified by the IBM PL/I group so I can put it up on the DFSORT website.

Thanks.
_________________
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
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Fri Mar 12, 2004 4:31 am    Post subject: Reply with quote

Hi Frank
I tried the OPTION ZDPRINT. It does not show the F char anymore but also does not add.

For eg:

Input record:
2001FZ01000702400000001800000003600000002000000002800000000800000002400000002400
2001FZ01000702400000000000000000000000000000000000000000000500000000000000000000

Sysin statements:
//SYSIN DD *
SORT FIELDS=(1,15,CH,A)
OPTION ZDPRINT
SUM FIELDS=(16,9,25,9),FORMAT=ZD
/*

Output statement:
2001FZ01000702400000001800000003600000002000000002800000000800000002400000002400

As you can see 0000000080 and 000000050 should have been added to 000000130 but the result is still 000000080.
Back to top
View user's profile Send private message
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Fri Mar 12, 2004 5:06 am    Post subject: Reply with quote

Sorry Frank..Please ignore the previous post. Obviously I did not add the mentioned columns. I tested and it works.

Thanks a ton.

Regards,
Realxing
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Mar 12, 2004 6:34 am    Post subject: Reply with quote

Frank,

I will try to put up a table for PLI formats as soon as possible.

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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