Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
how to get total count from numeric data in jcl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: how to get total count from numeric data in jcl
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

Active User


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

PostPosted: Fri Oct 09, 2020 8:59 pm    Post subject:
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: 2492
Location: NY,USA

PostPosted: Fri Oct 09, 2020 9:27 pm    Post subject:
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    Post subject: Reply to: how to get total count from numeric data in jcl
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

Active User


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

PostPosted: Fri Oct 09, 2020 9:52 pm    Post subject:
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    Post subject: Reply to: how to get total count from numeric data in jcl
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

Active User


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

PostPosted: Fri Oct 09, 2020 10:51 pm    Post subject:
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    Post subject: Reply to: how to get total count from numeric data in jcl
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

Active Member


Joined: 29 Apr 2008
Posts: 865
Location: Maryland

PostPosted: Sat Oct 10, 2020 12:15 am    Post subject:
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: 2422
Location: Hampshire, UK

PostPosted: Sat Oct 10, 2020 2:36 am    Post subject: Reply to: how to get total count from numeric data in jcl
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing Data Type tgwacker50 SYNCSORT 4 Mon Oct 19, 2020 9:06 pm
No new posts Copying data from prev record using SORT bshkris SYNCSORT 19 Thu Oct 15, 2020 3:29 pm
No new posts Creating a single-record file with CO... Joerg.Findeisen DFSORT/ICETOOL 8 Tue Oct 06, 2020 8:19 pm
No new posts To convert numeric to Packed Decimal vinu78 DFSORT/ICETOOL 9 Fri Jul 31, 2020 7:14 pm
No new posts Extract part of data from file and wr... sathyajes DFSORT/ICETOOL 9 Thu Jul 16, 2020 10:49 am

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us