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

Syncsort count records & match with the count in trailer


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

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu Apr 29, 2010 7:20 pm
Reply with quote

Hi,

my requierement is as-

1 a
2 b
3 c
4 d
5 e
6 f
7 TRAILER 0006

I need to take the count of records(i.e. first 6 in example) in the file and then compare that count with the number that is mentioned against TRAILER(0006). How can it be done using SORT or other utility?
Now if that matches/not matches, is it possible to get some output/return code, based on which I'll run one more step to generate a mail ?
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu Apr 29, 2010 7:22 pm
Reply with quote

file length can be taken as 80-FB.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 7:26 pm
Reply with quote

what are the exact column locations
of the word TRAILER
and
the count within the trailer record.
will the count always contain leading zeroes
and always be the same length?

can there be more than one trailer record?
are all records to be considered as detail records?
except
the trailer record, which you will define according to the above questions.
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu Apr 29, 2010 7:36 pm
Reply with quote

Thanks for response.

File looks like this-


Code:
=COLS>    ----+----1----+----2--
001260    03111     99999     42
001261    TRAILER 001259       


This tells you the positioning and count information.
Leading zeroes presence depends on the count as you can see.

yes Length would be same.
Single trailer record wil be there.

Yes all records are same, kind of detail recs.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 29, 2010 8:29 pm
Reply with quote

Below code will give you, RC 16 if count doesn't match else 0
Code:

//S1    EXEC  PGM=SORT                     
//SORTIN DD *                               
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
03111     99999     42                     
TRAILER 000112                             
//SORTOUT DD DSN=&&TEMP,DISP=(NEW,PASS)     
//SYSOUT    DD  SYSOUT=*                   
//SYSIN    DD  *                           
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,6,ZD))               
  OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,81,6,ZD),   
  NULLOFL=RC16                                                   
/*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 29, 2010 9:13 pm
Reply with quote

Opps... I have included trailer records also while comparing count.
In your first record shown there are 6 records so rec count at trailer is without including trailer record.
Do the change in sortcard as shown below to do what you expected.
Code:

//SYSIN    DD  *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,6,ZD,START=0))     
  OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,81,6,ZD), 
  NULLOFL=RC16                                                 
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu Apr 29, 2010 9:54 pm
Reply with quote

Escapa..thanks a lot for your help. I'll test run it and confirm the results, which most probably would be positive.

Apart from this solution can you pls brief me over the parameters/steps you have mentioned. What they actually will do. For eg-

Code:
OVERLAY=(81:SEQNUM,6,ZD))               


So that next time i can frame it up myself in case I need. or i can at least modify the card based on LRECL etc which can vary.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 29, 2010 10:10 pm
Reply with quote

t5590ag wrote:
I'll test run it and confirm the results, which most probably would be positive.

It is tested.

t5590ag wrote:
can you pls brief me over the parameters/steps you have mentioned. What they actually will do.

Here you will get all required. icon_smile.gif

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/ice1ca40/CONTENTS?SHELF=&DT=20090527161936#3.8
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu Apr 29, 2010 11:22 pm
Reply with quote

Hi am using this- my I/P file has LRECL=400, so I replaced 81 with 401-


Code:
//SORTIN  DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT,DISP=SHR     
//SORTOUT DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT.SORTED,       
//            DISP=(NEW,CATLG,KEEP),                           
//            UNIT=DISK,                                       
//            SPACE=(CYL,(50,100),RLSE),                       
//            DCB=(RECFM=FB,LRECL=400,BLKSIZE=0)               
//SYSOUT    DD  SYSOUT=*                                       
//SYSIN    DD  *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,6,ZD))           
  OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,401,6,ZD),
  NULLOFL=RC16                                                 
/*                                                             





Do u see a problem here ? am getting RC=0 only everytime.

Here is the spool-

Code:
WER108I  SORTIN   : RECFM=FB   ; LRECL=   400; BLKSIZE= 27600                 
WER257I  INREC RECORD LENGTH =   406                                           
WER238I  POTENTIALLY INEFFICIENT USE OF INREC                                 
WER110I  SORTOUT  : RECFM=FB   ; LRECL=   400; BLKSIZE= 27600                 
WER405I  SORTOUT  :  DATA RECORDS OUT          0; TOTAL RECORDS OUT          0
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
WER054I  RCD IN          5, OUT          5             
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Apr 29, 2010 11:33 pm
Reply with quote

SyncSort for z/OS 1.3 Programmer’s Guide wrote:
The NULLOFL parameter specifies the action to be taken when any non-SORTOUT OUTFIL data set contains no data records.
I think your problem is that you have a SORTOUT OUTFIL, try using FILES or FNAMES to make it a non-SORTOUT OUTFIL data set.
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu Apr 29, 2010 11:52 pm
Reply with quote

ohh !! damn it..! thanks Will, that was silly.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Apr 29, 2010 11:53 pm
Reply with quote

t5590ag wrote:
that was silly.
See what happens when you actually look at the manual?....grin.....
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Fri Apr 30, 2010 12:01 am
Reply with quote

am sorry Will, i thot its my mistake, but I just took it frm Escapa as is I see. I changed names to FILEIN and FILEOUT. Still the spool says-
Code:
 SYSIN :                                                           
   SORT FIELDS=COPY                                               
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,6,ZD))             
   OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,401,6,ZD),   
   NULLOFL=RC16                                                   
 WER276B  SYSDIAG= 3105571, 4858101, 4858101, 4731549             
 WER164B  7,908K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
 WER164B     0 BYTES RESERVE REQUESTED, 2,016K BYTES USED         
 WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                   
 WER224A  SORTOUT  NOT DEFINED                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                     


and it abends
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Fri Apr 30, 2010 12:02 am
Reply with quote

can you pls tell me whats gonna work..what names shall I use?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 30, 2010 12:19 am
Reply with quote

William Thompson wrote:
try using FILES or FNAMES to make it a non-SORTOUT OUTFIL data set.
Have you looked at the manual? It is all explained there, please try looking again.
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Fri Apr 30, 2010 7:10 pm
Reply with quote

ok I have tried few things. This is one-

Code:
//STEP01  EXEC PGM=SORT                                         
//SORTIN  DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT,DISP=SHR       
//SORTOF01 DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT.SORTED,       
//            DISP=(NEW,CATLG,KEEP),                           
//            UNIT=DISK,                                       
//            SPACE=(CYL,(50,100),RLSE),                       
//            DCB=(RECFM=FB,LRECL=400,BLKSIZE=0)               
//SYSOUT    DD  SYSOUT=*                                       
//SYSIN    DD  *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,6,ZD,START=0))   
  OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,401,6,ZD),
  NULLOFL=RC16                                                 
/*                                                             
can anyone pls let me know what is prob here.

here is my spool-

Code:
 SYNCSORT FOR Z/OS  1.3.0.3R    U.S. PATENTS: 4210961, 5117495   (C)
                                             Chrysler LLC   z/OS   1
 SYNCSORT LICENSED FOR CPU SERIAL NUMBER 1F444, MODEL 2097 510     
 SYSIN :                                                           
   SORT FIELDS=COPY                                                 
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,6,ZD,START=0))       
   OUTFIL INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,401,6,ZD),   
   NULLOFL=RC16                                                     
 WER276B  SYSDIAG= 3116379, 4868895, 4868895, 4731549               
 WER164B  7,908K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
 WER164B     0 BYTES RESERVE REQUESTED, 2,016K BYTES USED           
 WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                   
 WER224A  SORTOUT  NOT DEFINED                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                     
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 30, 2010 7:14 pm
Reply with quote

WER224A SORTOUT NOT DEFINED
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Fri Apr 30, 2010 7:21 pm
Reply with quote

yes Dick thats fine, but i am not sure how to put them in sync using both OUTFIL and SORTOUT, so I tried this-

Code:
//SORTIN  DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT,DISP=SHR
//SORTOUT  DD DUMMY                                     
//SORTOF01 DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT.SORTED,


but its giving simply RC=0. I am expecting a 16 per the sort condition.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 30, 2010 7:44 pm
Reply with quote

Again:
CICS Guy wrote:
William Thompson wrote:
try using FILES or FNAMES to make it a non-SORTOUT OUTFIL data set.
Have you looked at the manual? It is all explained there, please try looking again.
icon_rolleyes.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Apr 30, 2010 7:45 pm
Reply with quote

Try changing this
Code:
OUTFIL INCLUDE=(
to
Code:
OUTFIL FNAMES=SORTOF01,INCLUDE=(
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Fri Apr 30, 2010 9:17 pm
Reply with quote

hi all , thanks for all the help you are rendering.
i understand your concern that I should look at the manual. i checked it but its not helping me out in one day. and my query is regarding something which am working on right now so its not feasible for me to create a desired sort card just by looking at the manual. am jut trying to get the solution first and then go to the manual to understand it once it works for me.

I hope its fine.

Coming back to my JCL-
it still has some prob-

Code:
//STEP01  EXEC PGM=SORT                                     
//SORTIN  DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT,DISP=SHR   
//SORTOF01 DD DSN=T5590AG.BPTQ625Z.REFORMAT.INPUT.SORTED,   
//            DISP=(NEW,CATLG,KEEP),                         
//            UNIT=DISK,                                     
//            SPACE=(CYL,(50,100),RLSE),                     
//            DCB=(RECFM=FB,LRECL=400,BLKSIZE=0)             
//SYSOUT    DD  SYSOUT=*                                     
//SYSIN    DD  *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,6,ZD,START=0))
  OUTFIL FNAMES=SORTOF01,                                   
  INCLUDE=(1,7,CH,EQ,C'TRAILER',AND,9,6,ZD,EQ,401,6,ZD),     
  NULLOFL=RC16                                               
/*                                                           


following spool-it says sortout/outfil contains no recs-



Code:
WER164B  7,908K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,           
WER164B     0 BYTES RESERVE REQUESTED, 2,339,720 BYTES USED                   
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  SORTIN   : RECFM=FB   ; LRECL=   400; BLKSIZE= 27600                 
WER257I  INREC RECORD LENGTH =   406                                         
WER238I  POTENTIALLY INEFFICIENT USE OF INREC                                 
WER110I  SORTOF01 : RECFM=FB   ; LRECL=   400; BLKSIZE= 27600                 
WER410B  5,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,     
WER410B     0 BYTES RESERVE REQUESTED, 2,192,264 BYTES USED                   
WER405I  SORTOF01 :  DATA RECORDS OUT          0; TOTAL RECORDS OUT          0
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER461A  SORTOUT/OUTFIL DATA SET CONTAINS NO DATA RECORDS                     
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
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: Fri Apr 30, 2010 9:27 pm
Reply with quote

Hello,

Quote:
following spool-it says sortout/outfil contains no recs-
Why do you believe this is a problem?

What you have executed should have no output data when the trailer count does not match the "seqnum" record count. . .

I believe you may need to adjust the count as the trailer may be included in the seqnum. . .
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 30, 2010 9:28 pm
Reply with quote

Read the manual....
SyncSort for z/OS 1.3 Programmer’s Guide wrote:
The NULLOFL parameter specifies the action to be taken when any non-SORTOUT OUTFIL data set contains no data records.
RC0 The delivered default instructs SyncSort to issue a return code of 0 if not overridden by a higher return code set for another reason.
RC4 Instructs SyncSort to issue a WER461I warning message and continue processing. A return code of 4 will be issued if not overridden by a higher return code set for
another reason.
RC16 Instructs SyncSort to issue a WER461A message and to terminate processing with a return code of 16.
Was a WER461 message generated?
What letter (severity) code was used?
What was the return code of the job step?
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Sun May 02, 2010 3:53 pm
Reply with quote

Hi dick/CICS,

Thanks for the information. If I combine things you both said, it explains it all. I am getting user abend-

Code:
    06.14.01 JOB11007 $HASP165 T5590AG4 ENDED AT ODDC - ABENDED S000 U0016 CN(INTER
NAL)                                                                               
    ***                                                                               


my requirement is to just get a return code based on the match of counts and then proceed based on that RC. But RC16 leads to the abend. Shall I change it to RC4 from SORT step and then go ahead.is it advisable ?
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: Sun May 02, 2010 4:00 pm
Reply with quote

Hello,

Quote:
But RC16 leads to the abend.
Why do you believe this?

A return-code 16 is NOT the same as a U0016 abend.

There should be some diagnostic message thatb explains the U0016. . .
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 Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top