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

how to get total count from numeric data in jcl


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Suehowe

New User


Joined: 09 Oct 2020
Posts: 5
Location: US

PostPosted: Fri Oct 09, 2020 8:34 pm
Reply with quote

hi all

i have file like this

Code:
1
1
1
2
2
2
2


desired output file
Code:

total number of 1's are :3
total number of 2's are :4


i am aware we can use sort/syncsort jcl, could you please help what i need to code in sysin to get desired results
Code'd
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Fri Oct 09, 2020 8:59 pm
Reply with quote

Code:
//SECTIONS EXEC PGM=SORT                                     
//SORTIN   DD *                                             
1                                                           
1                                                           
1                                                           
2                                                           
2                                                           
2                                                           
2                                                           
/*                                                           
//SYSOUT  DD SYSOUT=*                                       
//SORTOUT DD SYSOUT=*                                       
//SYSIN   DD *                                               
  SORT FIELDS=(1,1,CH,A)                                     
  OUTFIL FNAMES=(SORTOUT),                                   
    REMOVECC,NODETAIL,                                       
    SECTIONS=(1,1,                                           
      TRAILER3=(C'total number of ',1,1,C'''s are:',COUNT)) 
  END                                                       
/*

Output:
Code:
********************************
total number of 1's are:       3
total number of 2's are:       4
********************************


Please see also the Beginner's Forum at http://www.ibmmainframeforum.com for students.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Oct 09, 2020 9:27 pm
Reply with quote

Welcome!
Please go thru the forum rules to know how to use Code tags.
Quote:
i am aware we can use sort/syncsort jcl, could you please help what i need to code in sysin to get desired results
You are asking for a ready-made solution for a simple task. You did not even try to search the forum. There are already several discussions on the same requirements like you have so please take a time and do some research and try it your self first else as suggested navigate to Beginners forum.
Back to top
View user's profile Send private message
Suehowe

New User


Joined: 09 Oct 2020
Posts: 5
Location: US

PostPosted: Fri Oct 09, 2020 9:31 pm
Reply with quote

Thank you much Joerg for prompt reply, I am getting errors, here is my revised requirement


Input file had data like this
12345
12345
12345
56789
56789
56789
56789

desired output file

total number of 12345's are :3
total number of 56789's are :4

JCL used

//STEP060 EXEC PGM=SORT
//IDIOFF DD DUMMY
//SORTIN DD DSN=file1.test,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,5,UFF,A)
OUTFIL FNAMES=(SORTOUT),
REMOVECC,NODETAIL,
SECTIONS=(1,5,
TRAILER3=(C'TOTAL NUMBER OF '1,5 C'''S ARE',COUNT))
END
/*

Error I got

SYSIN :
SORT FIELDS=(1,5,UFF,A)
OUTFIL FNAMES=(SORTOUT),
REMOVECC,NODETAIL,
SECTIONS=(1,5,
TRAILER3=(C'TOTAL NUMBER OF '1,5 C'''S ARE',COUNT))
*
END
WER813I INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

When I do JCL check before summitting job , I got error message like below


LINE # LABEL# SV MSG. ID. ERROR MESSAGE TEXT
====== ====== == ======== ============================================

000010 8 CAY6018E UNMATCHED PARENTHESES
000010 8 CAY6048E "C"TOTAL NUMBER OF "1" IS ILLEGAL OPERAND
FOR "R|P,L|KEYWORD" PARAMETER OF "TRAILER3"
000010 4 CAY6032W VALUE OF "M" PARAMETER OF "TRAILER3"
SHOULD NOT BE NULL
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Fri Oct 09, 2020 9:52 pm
Reply with quote

Do not skip provided comma, it runs exactly with this SYSIN:
Code:
SORT FIELDS=(1,5,UFF,A)                                     
OUTFIL FNAMES=(SORTOUT),                                   
  REMOVECC,NODETAIL,                                       
  SECTIONS=(1,5,                                           
    TRAILER3=(C'TOTAL NUMBER OF ',1,5,C'''S ARE: ',COUNT))
END

Code:
WER169I  RELEASE 2.1 BATCH 0539 TPF LEVEL 7.0
 WER052I  END SYNCSORT - ..,..
TOTAL NUMBER OF 12345'S ARE:        3         
TOTAL NUMBER OF 56789'S ARE:        4         
Back to top
View user's profile Send private message
Suehowe

New User


Joined: 09 Oct 2020
Posts: 5
Location: US

PostPosted: Fri Oct 09, 2020 10:23 pm
Reply with quote

Sorry my bad, made corrections but jcl is getting filed with “SORTOUT HEADER/TRAILER N FIELD OUTSIDE RANGE "

I have input file which has millions of records , example below

12345
12345
12345
12345
12345
12345
12345 ( I have repeated lines of 12345 around 3000 times)
..
..
..
56789
56789
56789
56789
56789
56789
56789 ( I have repeated lines of 56789 around 6000 times)





//SYSIN DD *
SORT FIELDS=(1,5,UFF,A)
OUTFIL FNAMES=(SORTOUT),
REMOVECC,NODETAIL,
SECTIONS=(1,5,
TRAILER3=(C'TOTAL NUMBER OF ',1,5,C'''S ARE: ',COUNT))
END
/*


WER108I SORTIN : RECFM=FB ; LRECL= 5; BLKSIZE= 32760
WER073I SORTIN : DSNAME=DB2D.DBA.A667353.H3.T1
WER110I SORTOUT : RECFM=FB ; LRECL= 5; BLKSIZE= 32760
WER074I SORTOUT : DSNAME=A667353.A66735S2.J0596997.D0000103.?
WER230A SORTOUT HEADER/TRAILER N FIELD OUTSIDE RANGE
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Fri Oct 09, 2020 10:51 pm
Reply with quote

One more:
Code:
  SORT FIELDS=(1,5,UFF,A)                                     
  OUTFIL FNAMES=(SORTOUT),                                     
    REMOVECC,NODETAIL,                                         
    SECTIONS=(1,5,                                             
      TRAILER3=(C'TOTAL NUMBER OF ',1,5,C'''S ARE: ',COUNT)),
    BUILD(80:X)                                               
  END
Back to top
View user's profile Send private message
Suehowe

New User


Joined: 09 Oct 2020
Posts: 5
Location: US

PostPosted: Sat Oct 10, 2020 12:09 am
Reply with quote

wow Joerg icon_smile.gif your magic worked much appreciated !!!!, i have been struggling for this from past week and my collogue told this forum

have nice weekend , will get back if any more questions
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sat Oct 10, 2020 12:15 am
Reply with quote

It’s a shame that this level of discussion continues endlessly on the experts forum.
“How to type blanks and commas in JCL...” icon_pray.gif 36_2_18.gif icon_axe.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat Oct 10, 2020 2:36 am
Reply with quote

The solution has nowt to do with JCL and all the utility messages are from Syncsort. This is the DFsort section of the forum. Topic moved whereupon the previous should say 'was the dfsort...'
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top