View previous topic :: View next topic
|
Author |
Message |
danylele74
New User
Joined: 03 Jul 2014 Posts: 28 Location: Italy
|
|
|
|
Hi all.
i have an input file like this:
Code: |
AAAAAA 11111111 222222222
AAAAAA 33333333 444444444
BBBBBB 11111111 555555555
CCCCCC 77777777 888888888
|
I need to create an output file entering an header everytime data change like this:
Code: |
col1 col2 col3
AAAAAA 11111111 222222222
AAAAAA 33333333 444444444
col1 col2 col3
BBBBBB 11111111 555555555
col1 col2 col3
CCCCCC 77777777 888888888
|
including the blank line.
Is it possible to do with a jcl ?
Thank you. |
|
Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 743 Location: Denmark
|
|
|
|
No, you need a program.
JCL is for allocating resources and initiating programs. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2159 Location: USA
|
|
|
|
It is not possible in JCL.
It is possible when using:
1) SYNCSORT or DFSORT utilities
2) code in REXX
3) code in COBOL
4) code in C/C++
……..
100500) code in almost any programming language, or tool.
JCL is the only one language which cannot do what you need. |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1353 Location: Bamberg, Germany
|
|
|
|
I guess that we will not see a solution from the TS here. It should look like this:
Code: |
//WHATEVER EXEC PGM=ICEMAN
//SORTIN DD *
AAAAAA 11111111 222222222
AAAAAA 33333333 444444444
BBBBBB 11111111 555555555
CCCCCC 77777777 888888888
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=(SORTOUT),
REMOVECC,
SECTIONS=(1,6,SKIP=1L,
HEADER3=(1:C'Col1',10:C'Col2',19:C'Col3')),
BUILD=(1,80)
END
/* |
Output:
Code: |
****** ****************************
000001 Col1 Col2 Col3
000002 AAAAAA 11111111 222222222
000003 AAAAAA 33333333 444444444
000004
000005 Col1 Col2 Col3
000006 BBBBBB 11111111 555555555
000007
000008 Col1 Col2 Col3
000009 CCCCCC 77777777 888888888
****** **************************** |
|
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2159 Location: USA
|
|
|
|
As a fool-proof, the SORT on SECTIONS columns needs to be added, I guess. |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1353 Location: Bamberg, Germany
|
|
|
|
sergeyken wrote: |
As a fool-proof, the SORT on SECTIONS columns needs to be added, I guess. |
I had that in my test case.  |
|
Back to top |
|
 |
|