Page 1 of 2

sort:count

PostPosted: Tue Mar 19, 2013 1:03 pm
by pearl
what is wrong with this code? It goes in an infinite loop..
               
 000100 //xxxxxx   JOB (1234),CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),               
 000200 //            NOTIFY=&SYSUID,PRTY=15                                   
 000300 //STEP1    EXEC PGM=SORT                                               
 000400 //SORTIN   DD DSN=xxxxx.xxxx.xxxxx(IP1),DISP=SHR                     
 000500 //SORTOUT  DD DSN=xxxxxx.xxxx.xxxxxx(OP1),                             
 000600 //            DISP=(NEW,CATLG,DELETE),                                 
 000700 //            SPACE=(TRK,(1,2),RLSE),                                   
 000800 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)                       
 001000 //SYSIN    DD *                                                         
 001100    SORT FIELDS=COPY,                                                   
 001110    OUTFIL REMOVECC,NODETAIL,                                           
 001120           TRAILER1=('NO OF RECORDS:',COUNT=(M11,LENGTH=7))             
 001200 /*                                                                     
 001300 //SYSOUT   DD SYSOUT=*                                                 
 

Re: sort:count

PostPosted: Tue Mar 19, 2013 1:17 pm
by enrico-sorichetti
instead of running using two dat sets try with
//SORTIN DD *
some data
...
more data
//SORTOUT DD SYSOUT=*

Re: sort:count

PostPosted: Tue Mar 19, 2013 3:49 pm
by pearl
I tried to do as you said.But,its still going in an infinaite loop

Re: sort:count

PostPosted: Tue Mar 19, 2013 4:20 pm
by enrico-sorichetti
the chances of getting help on such a problem are pretty slim
better ask Your support

the best reply You might get on a forum is the confirmation that
 ****** ***************************** 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 SOME DATA
 000009 ...
 000010 MORE DATA
 000011 //SORTOUT   DD SYSOUT=*
 000012 //SYSIN     DD *
 000013   SORT FIELDS=COPY
 000014   OUTFIL REMOVECC,NODETAIL,
 000015          TRAILER1=('NO OF RECORDS:',COUNT=(M11,LENGTH=7))
 ****** **************************** Bottom of Data ****************************

runs correctly and returns
********************************* TOP OF DATA **********************************
NO OF RECORDS:0000003
******************************** BOTTOM OF DATA ********************************


looking over again at Your control cards You should have received some kind of syntax error
because the comma at the end of the SORT statement implies a continuation when none is needed
just get rid of it ( the comma ) and see what happens

the forum contains zillions of <sort> examples,
You should have spotted the error Yourself :mrgreen:

Re: sort:count

PostPosted: Tue Mar 19, 2013 4:46 pm
by BillyBoyo
I think it wildly unlikely you get a loop in SORT. Show the sysout from the step, please.

Or, claiming an "infinite loop" for something with syntax errors, are you Trolling?

Re: sort:count

PostPosted: Tue Mar 19, 2013 5:28 pm
by pearl
thankx alot...your code is working. but, i am yet to find the error in mine. :(

Re: sort:count

PostPosted: Tue Mar 19, 2013 5:43 pm
by steve-myers
pearl wrote:what is wrong with this code? It goes in an infinite loop..
               
 000100 //xxxxxx   JOB (1234),CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),               
 000200 //            NOTIFY=&SYSUID,PRTY=15                                   
...
 
If I were your boss, and saw the JCL in the quote, I'd show you the door real quick!

Re: sort:count

PostPosted: Tue Mar 19, 2013 5:51 pm
by steve-myers
As Mr. Sorrichetti and Billyboyo say, it is very unlikely that the sort product will loop. However, you better look at your SORTOUT DD statement. There is a serious error there, though I will leave it to you to deduce the error.

Re: sort:count

PostPosted: Tue Mar 19, 2013 5:53 pm
by enrico-sorichetti
thankx alot...your code is working. but, i am yet to find the error in mine.


should not be that difficult... did You read my comment about the EXTRA comma ???

Re: sort:count

PostPosted: Tue Mar 19, 2013 6:08 pm
by BillyBoyo
Plus, if you just want a count of the records, have a look at ICETOOL's COUNT operator.