|
View previous topic :: View next topic
|
| Author |
Message |
Suehowe
New User
Joined: 09 Oct 2020 Posts: 5 Location: US
|
|
|
|
hi all
i have file like this
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
| 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 |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
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 |
|
 |
Suehowe
New User
Joined: 09 Oct 2020 Posts: 5 Location: US
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
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 |
|
 |
Suehowe
New User
Joined: 09 Oct 2020 Posts: 5 Location: US
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
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 |
|
 |
Suehowe
New User
Joined: 09 Oct 2020 Posts: 5 Location: US
|
|
|
|
wow Joerg 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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2263 Location: USA
|
|
|
|
It’s a shame that this level of discussion continues endlessly on the experts forum.
“How to type blanks and commas in JCL...”  |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|