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

Example codes for Control Statements using SKIP; COUNT; SUM


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Supriya Das

New User


Joined: 18 Jul 2008
Posts: 5
Location: India

PostPosted: Fri Jul 25, 2008 12:20 pm
Reply with quote

Where can I find 3 separate coding examples for Control Statements using SKIP; COUNT; SUM. Do I have to use INCLUDE control statement along with those control statements? If you can guide me toward the right URL/hyperlink I will appreciate it. icon_confused.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 25, 2008 12:27 pm
Reply with quote

Click here for some useful links
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: Fri Jul 25, 2008 8:54 pm
Reply with quote

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links

Your questions are rather vague so it's a bit difficult to answer them, but ...

DFSORT has a SKIP keyword on the OUTFIL statement, but I suspect what you're really asking about is the SKIPREC keyword on the OPTION statement. Here's a link to complete details of the OPTION statement:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.12?DT=20060615185603

Here's a link to an example with SKIPREC:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.12.2.1?SHELF=&DT=20060615185603

COUNT is a keyword on the TRAILERx (TRAILER1, TRAILER2, TRAILER3) operand of the OUTFIL statement. Here's a link to complete details on the OUTFIL statement:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.13?DT=20060615185603

Here's a link to an example with COUNT:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.13.2.4?SHELF=&DT=20060615185603&CASE=

SUM is a control statement. Here's a link to complete details on the SUM statement:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.17?DT=20060615185603

Here's a link to examples with SUM:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.17.2?DT=20060615185603

You would need INCLUDE if you want to include records based on a criteria. Here's a link to complete details on the INCLUDE statement:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.7?DT=20060615185603

Here's a link to some examples with INCLUDE:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.7.3?DT=20060615185603

If you want something more specific, explain in detail what you want to do.
Back to top
View user's profile Send private message
Supriya Das

New User


Joined: 18 Jul 2008
Posts: 5
Location: India

PostPosted: Mon Jul 28, 2008 4:12 pm
Reply with quote

Thanks Frank. I have a another question. I know that

Code:

  SORT FIELDS=(4,2,CH,A)
  OPTION SKIPREC=20


is a valid control statement, but is it valid like:

Code:

  SORT FIELDS=null 
  OPTION SKIPREC=20


If not, what could be the right one? By the way, I do not want to sort the output dataset. icon_question.gif
Back to top
View user's profile Send private message
Supriya Das

New User


Joined: 18 Jul 2008
Posts: 5
Location: India

PostPosted: Mon Jul 28, 2008 4:53 pm
Reply with quote

I found the answer. It is:

Code:

   SORT FIELDS=COPY

icon_smile.gif
Back to top
View user's profile Send private message
Supriya Das

New User


Joined: 18 Jul 2008
Posts: 5
Location: India

PostPosted: Tue Jul 29, 2008 6:18 pm
Reply with quote

I have 10 records in Input dataset. Forth byte is signed packed decimal. One of those 10 records is a duplicate record which should be eleminated.

The valid code is:

Code:

  SORT FIELDS=(4,1,PD,A)
  SUM FIELDS=NONE     


The invalid code is:

Code:

  SORT FIELDS=(4,1,PD,A)                     
  SUM FIELDS=(4,1,PD)   


The question is why? icon_question.gif
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: Tue Jul 29, 2008 9:51 pm
Reply with quote

Hello,

Because it violates the "rules". . .

You cannot SUM a field that is a SORT FIELD (to do so really makes no sense). SUM is to total values within the SORT FIELDs. For example, total sales by customer.
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: Tue Jul 29, 2008 10:15 pm
Reply with quote

SUM fields cannot overlap SORT fields. If you really need to SORT on a field and SUM it as well, you could do it like this (I'm assuming your input file has RECFM=FB and LRECL=80):

Code:

  INREC OVERLAY=(81:4,1)
  SORT FIELDS=(81,1,PD,A)                     
  SUM FIELDS=(4,1,PD)   
  OUTREC BUILD=(1,80)
Back to top
View user's profile Send private message
Supriya Das

New User


Joined: 18 Jul 2008
Posts: 5
Location: India

PostPosted: Wed Jul 30, 2008 12:25 pm
Reply with quote

Thanks to Frank & Dick. You guys are really helpful. Frank, you are great.
icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
Search our Forums:

Back to Top