Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Example codes for Control Statements using SKIP; COUNT; SUM

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
Author Message
Supriya Das

New User


Joined: 18 Jul 2008
Posts: 5
Location: India

PostPosted: Fri Jul 25, 2008 12:20 pm    Post subject: Example codes for Control Statements using SKIP; COUNT; SUM
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
References
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 3744
Location: Brussels once more ...

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

Click here for some useful links
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Jul 25, 2008 8:54 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

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:

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

Here's a link to an example with SKIPREC:

http://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:

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

Here's a link to an example with COUNT:

http://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:

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

Here's a link to examples with SUM:

http://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:

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

Here's a link to some examples with INCLUDE:

http://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    Post subject: Null value for SORT control statement
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    Post subject: Reply to: Example codes for Control Statements using SKIP; C
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    Post subject: SUM Control
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

Global Moderator


Joined: 23 Nov 2006
Posts: 9211
Location: 221 B Baker St

PostPosted: Tue Jul 29, 2008 9:51 pm    Post subject:
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 Moderator


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

PostPosted: Tue Jul 29, 2008 10:15 pm    Post subject:
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    Post subject: Appreciation
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1