IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To get the count of the records based on a conditions


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ratnakumar

New User


Joined: 07 May 2009
Posts: 30
Location: Banglore

PostPosted: Tue Nov 15, 2011 5:09 pm
Reply with quote

ok.. let me check
Back to top
View user's profile Send private message
ratnakumar

New User


Joined: 07 May 2009
Posts: 30
Location: Banglore

PostPosted: Tue Nov 15, 2011 5:18 pm
Reply with quote

It worked.. Thanks you guys..
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 15, 2011 5:49 pm
Reply with quote

Thanks for letting us know. Can you confirm that it was enrico's code you used? May help others with similar problems.
Back to top
View user's profile Send private message
ratnakumar

New User


Joined: 07 May 2009
Posts: 30
Location: Banglore

PostPosted: Tue Nov 15, 2011 7:03 pm
Reply with quote

Yes, I used enrico's code. and it worked successfully
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 15, 2011 7:12 pm
Reply with quote

well, it would be useful if some good soul could check about the pickiness of SYNCSORT

I tested with dsfort also for records not matching the F or the D and I got 0 for the totals

can anybody please confirm that running

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=H                       
 000003 //*                                                                     
 000004 //ICE     EXEC PGM=SORT                                                 
 000005 //SYSOUT    DD SYSOUT=*                                                 
 000006 //SYSPRINT  DD SYSOUT=*                                                 
 000007 //SORTIN    DD *                                                       
 000008 A1234F                                                                 
 000009 A1234D                                                                 
 000010 A2345D                                                                 
 000011 A3456F                                                                 
 000012 Z0000                                                                   
 000013 //SORTOUT   DD SYSOUT=*                                                 
 000014 //SYSIN     DD *                                                       
 000015   INREC IFTHEN=(WHEN=(6,1,CH,EQ,C'F'),OVERLAY=(81:C'1')),               
 000016         IFTHEN=(WHEN=(6,1,CH,EQ,C'D'),OVERLAY=(82:C'1'))               
 000017   SORT  FIELDS=(1,5,ZD,A),EQUALS                                       
 000018   OUTFILE REMOVECC,NODETAIL,BUILD=(80X),                               
 000019         HEADER1=('CM#',3X,'FOREIGN COUNT',2X,'DOMESTIC COUNT'),         
 000020         SECTIONS=(1,5,                                                 
 000021                   TRAILER3=(1,5,6X,TOT=(81,1,ZD,M10,LENGTH=8),         
 000022                                 8X,TOT=(82,1,ZD,M10,LENGTH=8)))         
 000023 //                                                                     
 ****** **************************** Bottom of Data ****************************


SYNCSORT will abend

while DFSORT will happily digest everything
Code:
********************************* TOP OF DATA **********************************
CM#   FOREIGN COUNT  DOMESTIC COUNT                                             
A1234             1               1                                             
A2345             0               1                                             
A3456             1               0                                             
Z0000             0               0                                             
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
ratnakumar

New User


Joined: 07 May 2009
Posts: 30
Location: Banglore

PostPosted: Tue Nov 15, 2011 7:30 pm
Reply with quote

I tested with SYNCSORT, And it failed with A data exception, S0C7.. Pasted below is the error message in ABENDAID

Code:
*             Error Location              *                               
*******************************************                               
                                                                         
The next sequential instruction to be executed in load module SS13X02C   
was at displacement 0000218A from the load point of the module.           
                           A B E N D - A I D                      PAGE 2 
                                                                         
The module was dynamically loaded.                                       
                                                                         
SS13X02C was loaded from the extended fixed link pack area (EFLPA).       
                                                                         
The module is 00002568 bytes long.                                       
                                                                         
                                                                         
*******************************************                               
*           Call Trace Summary            *                               
*******************************************                               
                                                                         
*******Calling*******  ****Return****           *******Called********     
Load-Mod  Program      Type     Value           Program      Load-Mod     
*SYSTEM                                Links to QKQMAIN      SYNCSORT     
                                                                           
        The program causing the error is not on the calling               
        chain.                                                             
                                                                           
                                                                           
One or more modules loaded from the LINKLIST.                             
Current LINKLIST library set is LNKLSTXX                                   


Please let me know if you need any other details.
Back to top
View user's profile Send private message
ratnakumar

New User


Joined: 07 May 2009
Posts: 30
Location: Banglore

PostPosted: Tue Nov 15, 2011 7:46 pm
Reply with quote

Just an FYI..

The SYNCSORT code (which worked for me earlier) had failed with SOC-0C7, with the instream data Z000 (i.e without F or D at position 6)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 15, 2011 7:56 pm
Reply with quote

so it seems that DFSORT is more forgiving than SYNCSORT

in this case probably the proper snippet would be
Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=H                       
 000003 //*                                                                     
 000004 //ICE     EXEC PGM=SORT                                                 
 000005 //SYSOUT    DD SYSOUT=*                                                 
 000006 //SYSPRINT  DD SYSOUT=*                                                 
 000007 //SORTIN    DD *                                                       
 000008 A1234F                                                                 
 000009 A1234D                                                                 
 000010 A2345D                                                                 
 000011 A3456F                                                                 
 000012 Z0000                                                                   
 000013 //SORTOUT   DD SYSOUT=*                                                 
 000014 //SYSIN     DD *                                                       
 000015   INREC IFTHEN=(WHEN=(6,1,CH,EQ,C'F'),OVERLAY=(81:C'10')),             
 000016         IFTHEN=(WHEN=(6,1,CH,EQ,C'D'),OVERLAY=(81:C'01')),             
 000017         IFTHEN=(WHEN=NONE,OVERLAY=(81:C'00'))                           
 000018   SORT  FIELDS=(1,5,CH,A),EQUALS                                       
 000019   OUTFILE REMOVECC,NODETAIL,BUILD=(80X),                               
 000020         HEADER1=('CM#',3X,'FOREIGN COUNT',2X,'DOMESTIC COUNT'),         
 000021         SECTIONS=(1,5,                                                 
 000022                   TRAILER3=(1,5,6X,TOT=(81,1,ZD,M10,LENGTH=8),         
 000023                                 8X,TOT=(82,1,ZD,M10,LENGTH=8)))         
 000024 //                                                                     
 ****** **************************** Bottom of Data ****************************


everything initialized and all types properly defined
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Nov 15, 2011 9:04 pm
Reply with quote

Quote:
so it seems that DFSORT is more forgiving than SYNCSORT

in this case probably the proper snippet would be

For ZD in this scenario,DFSort ignores/doesn't consider zone thus 40 becomes 0.

Thanks,
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 15, 2011 9:17 pm
Reply with quote

yes... for the existing fields ...
but then under the covers DFSORT considers undefined fields as x'00'

like when for the "F" case the overlay is on position 81..
but then DFSORT happily sums on position 82

and if position 6 i neither F or D .... nothing gets overlaid, but DFSORT is happy

puzzling icon_biggrin.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 16, 2011 12:48 am
Reply with quote

Enrico,

I haven't really been following this discussion (and I don't really want to take the time to read through everything).

Can you please show me a good (simple) example of what you're questioning in DFSORT? What does the input look like in hex? What is the DFSORT statement in question? What do you think is puzzling? The simpler you can make it, the better.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 16, 2011 12:59 am
Reply with quote

Hi Frank!
I am not really questioning DFSORT, I am just trying to understand !
do You want to take the idea exchange offline ?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 16, 2011 2:13 am
Reply with quote

Enrico,

Yes, I know that you're trying to understand and I'd like to help you do that. I just need to know the details of what we're discussing so I can respond accurately. I'm happy to discuss this here or offline as you prefer.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 16, 2011 3:37 am
Reply with quote

Hello,

Would it make sense to split this follow-on to another topic? Maybe in the Moderator part of the forum, or somehow "police" it so it does not become a free-for-all?

Personally, i'd like to be able to "watch" the proceedings icon_wink.gif

d
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 16, 2011 3:59 am
Reply with quote

Enrico sent me a note offline explaining what he is asking and I think I understand it to be:

Why does DFSORT allow a blank input value to be TOTALed as if it were a ZD zero?. For example, if we run this job with DFSORT:

Code:

//S1 EXEC PGM=SORT                           
//SYSOUT DD SYSOUT=*                         
//SORTIN DD *                                 
                                             
01                                             
                                             
02                                             
//SORTOUT DD SYSOUT=*                         
//SYSIN DD *                                 
  OPTION COPY                                 
  OUTFIL TRAILER1=(TOT=(1,2,ZD,TO=ZD,LENGTH=2))       


why does it give a valid total of 03 instead of an S0C7?

The answer is that DFSORT treats a ZD value like so:

zdzd...zdsd

d must be a valid digit (0-9).
z is the zone and is ignored. So X'40' for zd is treated as a decimal 0.
s is the sign. If s is F, E, C, A, 8, 6, 4, 2 or 0, it is treated as plus. If s is D, B, 9, 7, 5, 3 or 1, it is treated as minus. So X'40' for sd is treated as +0.

Therefore, X'4040' is treated as a ZD +0.

Note that this is all documented in "z/OS DFSORT Application Programming Guide".

Does that help?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Nov 16, 2011 4:29 am
Reply with quote

also, why should IBM's DFSORT
manipulate display numeric any different than IBM COBOL?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts How to load to DB2 with column level ... DB2 6
Search our Forums:

Back to Top