View previous topic :: View next topic
Author
Message
swapnadeep.ganguly Active User Joined: 21 Mar 2007Posts: 203 Location: India
Hi,
Is there any method using DFSORT by means of which we can put the File Name in front of the record present within the file.
Let us say,
We have a File named ABC which have the records as
111
222
333
444
I want the output as:
ABC111
ABC222
ABC333
ABC444
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Where does the file name information come from ?
Back to top
swapnadeep.ganguly Active User Joined: 21 Mar 2007Posts: 203 Location: India
The file name informations are kept within a LIST File. The File name varies based on the date.
Back to top
swapnadeep.ganguly Active User Joined: 21 Mar 2007Posts: 203 Location: India
I am using the following JCL:
Code:
//GENJOB EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYPRINT DD SYSOUT=*
//SORTIN DD DSN= LIST OF FILE NAMES
// DISP=SHR
//IRDR DD SYSOUT=(A,INTRDR) INTERNAL READER
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(1,44,81:SEQNUM,3,ZD)
OUTFIL FNAMES=IRDR,
REMOVECC,
HEADER1=('//CPYFILES JOB (0331,0000,01),''PRGMR'',',
'CLASS=A,MSGCLASS=X',/,
'//S0 EXEC PGM=IEFBR14',/,
'//DD01 DD DSN=TUA.SORT.ACQ.TEST,',/,
'// DISP=(MOD,DELETE,DELETE)',/,
'//*',/,
'//S1 EXEC PGM=ICEGENER',/,
'//SYSPRINT DD SYSOUT=*',/,
'//SYSUT2 DD DSN=TUA.SORT.ACQ.TEST,',/,
'// DISP=(NEW,CATLG,CATLG),SPACE=(CYL,(5,5)),',/,
'// DCB=(RECFM=FB,LRECL=91),',
'UNIT=RESDA',/,
'//SYSIN DD DUMMY'),
IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
BUILD=(1:C'//',10:C'DD DISP=SHR,DSN=',1,44,81:81,3)),
IFTHEN=(WHEN=(81,3,ZD,EQ,+1),OVERLAY=(3:C'SYSUT1'))
/*
The output that i am getting is as under:
Code:
XX04598
MM06692
AA02162
DD02477
EE03806
XX04598
MM06692
AA02162
DD02477
EE03806
XX04598
MM06692
AA02162
DD02477
EE03806
However my desired output should be:
Code:
<File Name1>XX04598
<File Name1>MM06692
<File Name1>AA02162
<File Name1>DD02477
<File Name1>EE03806
<File Name2>XX04598
<File Name2>MM06692
<File Name2>AA02162
<File Name2>DD02477
<File Name2>EE03806
<File Name3>XX04598
<File Name3>MM06692
<File Name3>AA02162
<File Name3>DD02477
<File Name3>EE03806
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Take a look at THIS previous thread, using symbols.
Back to top
swapnadeep.ganguly Active User Joined: 21 Mar 2007Posts: 203 Location: India
Can I use the above method in dynamically submitting JCL's?
Back to top
swapnadeep.ganguly Active User Joined: 21 Mar 2007Posts: 203 Location: India
Let me explain my problem a more vividly...
Actually based on date of execution, I have a LIST file that has all the Input File names written in it. The input file contains the date as well as a Sequence Number in the name.
My Requirement is:
I have to create a Output File that will have the Input File Name written first followed by the records that are present in the Input File. By this way, I can easily identify from which file which record came. Later I have to sort this single merged file and then create different sorted File with the same date and sequence number.
By using the above JCL, I am able to merge the records but I am not getting the File Name. Can you please point me out where particularly I am getting wrong.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
swapnadeep.ganguly,
Use the following DFSORT JCL which will generate the JCL with the filenames.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
FILE NAME 0001
FILE NAME 0002
FILE NAME 0003
FILE NAME 0004
FILE NAME 0005
FILE NAME 0006
//JBC DD DSN=&&J,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//TLC DD DSN=&&T,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//CTL DD DSN=&&C,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(1,44,81:SEQNUM,3,ZD)
OUTFIL FNAMES=JBC,REMOVECC,
BUILD=(C'//IN',81,3,12:C'DD DISP=SHR,DSN=',1,44,80:X),
HEADER1=('//CPYFILES JOB (0331,0000,01),''PRGMR'',',
'CLASS=A,MSGCLASS=X',/,
'//STEP0100 EXEC PGM=IEFBR14',/,
'//DD01 DD DSN=TUA.SORT.ACQ.TEST,',/,
'// DISP=(MOD,DELETE,DELETE),',/,
'// SPACE=(TRK,(1,0),RLSE)',/,
'//*',/,
'//STEP0200 EXEC PGM=ICETOOL',/,
'//TOOLMSG DD SYSOUT=*',/,
'//DFSMSG DD SYSOUT=*',/,
'//OUT DD DSN=TUA.SORT.ACQ.TEST,',/,
'// DISP=(MOD,CATLG,CATLG),',/,
'// SPACE=(CYL,(5,5)),',/,
'// UNIT=RESDA')
OUTFIL FNAMES=TLC,REMOVECC,
BUILD=(C' COPY FROM(IN',81,3,C') USING(C',81,3,C')',80:X),
HEADER1=('//TOOLIN DD *')
OUTFIL FNAMES=CTL,
BUILD=(C'//C',81,3,C'CNTL DD *',/,
C' OUTFIL FNAMES=OUT,',/,
C' BUILD=(C''',1,44,C'''',C',1,91)',80:X)
/*
//STEP0200 EXEC PGM=ICEGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=&&J,DISP=SHR
// DD DSN=&&T,DISP=SHR
// DD DSN=&&C,DISP=SHR
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY
The output from this job is
Code:
//CPYFILES JOB (0331,0000,01),'PRGMR',CLASS=A,MSGCLASS=X
//STEP0100 EXEC PGM=IEFBR14
//DD01 DD DSN=TUA.SORT.ACQ.TEST,
// DISP=(MOD,DELETE,DELETE),
// SPACE=(TRK,(1,0),RLSE)
//*
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//OUT DD DSN=TUA.SORT.ACQ.TEST,
// DISP=(MOD,CATLG,CATLG),
// SPACE=(CYL,(5,5)),
// UNIT=RESDA
//IN001 DD DISP=SHR,DSN=FILE NAME 0001
//IN002 DD DISP=SHR,DSN=FILE NAME 0002
//IN003 DD DISP=SHR,DSN=FILE NAME 0003
//IN004 DD DISP=SHR,DSN=FILE NAME 0004
//IN005 DD DISP=SHR,DSN=FILE NAME 0005
//IN006 DD DISP=SHR,DSN=FILE NAME 0006
//TOOLIN DD *
COPY FROM(IN001) USING(C001)
COPY FROM(IN002) USING(C002)
COPY FROM(IN003) USING(C003)
COPY FROM(IN004) USING(C004)
COPY FROM(IN005) USING(C005)
COPY FROM(IN006) USING(C006)
//C001CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(C'FILE NAME 0001 ',1,91)
//C002CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(C'FILE NAME 0002 ',1,91)
//C003CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(C'FILE NAME 0003 ',1,91)
//C004CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(C'FILE NAME 0004 ',1,91)
//C005CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(C'FILE NAME 0005 ',1,91)
//C006CNTL DD *
OUTFIL FNAMES=OUT,
BUILD=(C'FILE NAME 0006 ',1,91)
Back to top
Please enable JavaScript!