View previous topic :: View next topic
|
Author |
Message |
james chen
New User
Joined: 29 Aug 2014 Posts: 2 Location: China
|
|
|
|
We have a requirement for insert/add trailer for non empty file.
Please find the sample below.
Input file is non empty:
> Input file is non empty as below.
abc 1234
> Output file will be as below.
abc 1234
1A(1A is the trailer record)
Input file is empty:
> Output file is empty.
Would anyone can help? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Please, use the Code Button when presenting Code/Data. Have you tried anything yourself so far? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Use two JCL steps:
1)
Code: |
//NORMAL EXEC PGM=SORT,PARM='NULLOUT=RC4' |
Create your output as if it was not empty
2)
Code: |
//DUMMY EXEC PGM=SORT,COND=(4,EQ,NORMAL) |
When empty, override the same output from //NORMAL with the special record(s) |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
This snippet does the job from IN to OUT
Code: |
//ICETOOL EXEC PGM=ICETOOL
//IN DD *
abc 1234
/*
//OUT DD SYSOUT=*
//TRLUCNTL DD *
OUTFIL FNAMES=(OUT),
TRAILER1=(C'1A')
/*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
MODE STOP
COUNT FROM(IN) EMPTY RC8
COPY FROM(IN) USING(TRLU)
/* |
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
This snippet does the job from IN to OUT
Code: |
//ICETOOL EXEC PGM=ICETOOL
//IN DD *
abc 1234
/*
//OUT DD SYSOUT=*
//TRLUCNTL DD *
OUTFIL FNAMES=(OUT),
TRAILER1=(C'1A')
/*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
MODE STOP
COUNT FROM(IN) EMPTY RC8
COPY FROM(IN) USING(TRLU)
/* |
|
Is this not required to be marked as:
Quote: |
Input file is empty:
>
Code: |
Output file is empty. |
|
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
sergeyken wrote: |
Is this not required to be marked as.. |
I have read it as adding a single line trailer ("1A") when DSN is not empty. |
|
Back to top |
|
|
james chen
New User
Joined: 29 Aug 2014 Posts: 2 Location: China
|
|
|
|
sergeyken wrote: |
Joerg.Findeisen wrote: |
This snippet does the job from IN to OUT
Code: |
//ICETOOL EXEC PGM=ICETOOL
//IN DD *
abc 1234
/*
//OUT DD SYSOUT=*
//TRLUCNTL DD *
OUTFIL FNAMES=(OUT),
TRAILER1=(C'1A')
/*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
MODE STOP
COUNT FROM(IN) EMPTY RC8
COPY FROM(IN) USING(TRLU)
/* |
|
Is this not required to be marked as:
Quote: |
Input file is empty:
>
Code: |
Output file is empty. |
|
|
|
|
Back to top |
|
|
|