Is it possible to add timestamp in the Header Record?
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
Is it possible to add timestamp in the Header Record?
Hi i need to add header and trailer record to a file..
my data file will look like
aaaa
bbbb
ccccc
and my outfile should look like
HDR-Invoice-current timestamp
aaaa
bbbb
cccc
TRL-count
infile & outfile LRECL=80, RECFM = FB
can anyone please help me with a JCL for the above requirement?
my data file will look like
aaaa
bbbb
ccccc
and my outfile should look like
HDR-Invoice-current timestamp
aaaa
bbbb
cccc
TRL-count
infile & outfile LRECL=80, RECFM = FB
can anyone please help me with a JCL for the above requirement?
Thanks,
Ganesh.
Ganesh.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
I could have given you a better answer if you had shown exactly what you want the header and trailer to look like including the format of the date and count. But you didn't, so I'll have to guess. You can use a DFSORT job like the following to add a header and trailer:
SORTOUT would have:
If you want something else, tell me EXACTLY what you want.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
http://www.ibm.com/support/docview.wss? ... g3T7000080
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
aaaa
bbbb
ccccc
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('HDR-Invoice-',DATE=(4MD/),X,TIME=(24:)),
TRAILER1=('TRL-',COUNT=(M11,LENGTH=8))
Code: Select all
HDR-Invoice-2011/06/16 09:44:40
aaaa
bbbb
ccccc
TRL-00000003
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
I monitor this Forum (and DFSORT Forums on several other help boards) all day at work.I am really surprised to see this quick reply.
This was my first post in this forum and i am really pleased to see such a quick and relavant solution.
Glad to help. Next time, give more details of what you want so I don't have to guess.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
Hi Frank
Again i need your help!!
how to get the timestamp in the format YYYY-MM-DD HH:MI:SS
in header file..
before you suggested me to use
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('HDR-Invoice-',DATE=(4MD/),X,TIME=(24:)),
TRAILER1=('TRL-',COUNT=(M11,LENGTH=8))
but now i have to use this timestamp format
Again i need your help!!
how to get the timestamp in the format YYYY-MM-DD HH:MI:SS
in header file..
before you suggested me to use
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('HDR-Invoice-',DATE=(4MD/),X,TIME=(24:)),
TRAILER1=('TRL-',COUNT=(M11,LENGTH=8))
but now i have to use this timestamp format
Thanks,
Ganesh.
Ganesh.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
The only difference I see is a - instead of / for the date, so you would use:
Am I missing something?
Code: Select all
DATE=(4MD-),X,TIME=(24:)
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
Thank you very much Frank!!
Frank is there a way in sort for my below requirement.
i have a data file with some records.
name of the data file is DBARD.ADSS.EDR.TAB001.D&ODATE
i need to create another file which should have data like
--number of records in data file
--date in YYYY-MM-DD
--name of the data file (ie DBARD.ADSS.EDR.TAB001.D&ODATE)
--and timestamp in YYYY-MM-DD HH:MI:SS format
pls help
--
Frank is there a way in sort for my below requirement.
i have a data file with some records.
name of the data file is DBARD.ADSS.EDR.TAB001.D&ODATE
i need to create another file which should have data like
--number of records in data file
--date in YYYY-MM-DD
--name of the data file (ie DBARD.ADSS.EDR.TAB001.D&ODATE)
--and timestamp in YYYY-MM-DD HH:MI:SS format
pls help
--
Thanks,
Ganesh.
Ganesh.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
If you can set up the dsname as a SET or PROC symbol, then you can use a DFSORT job like the following:
Code: Select all
// SET DSN1=data_set_name
//S1 EXEC PGM=SORT,PARM='JP1"&DSN1"'
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&DSN1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=8),X,DATE=(4MD-),X,
JP1,X,DATE=(4MD-),X,TIME=(24:))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
-
- Member
- Posts: 14
- Joined: Thu Jun 16, 2011 10:18 am
Hi Frank,
i used the below job and created a file
//STEP2 EXEC PGM=SORT,PARM='CTL"DPSIT4B.&MLQ..TAB002.D&ODATE..UNLOAD"'
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTIN DD DSN=DBRDB.ABPDB.RMS.TAB002.D&ODATE..UNLOAD,DISP=SHR
//SORTOUT DD DSN=&HLQ..&MLQ..TAB002.D&ODATE..CTL,
// SPACE=(CYL,(150,100),RLSE),
// DCB=(LRECL=82,RECFM=FB),
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=10),'|',DATE=(4MD-),'|',
CTL,'|',DATE=(4MD-),X,TIME=(24:))
my output file has the record
0000000009|2011-07-21|DPSIT4B.ABPDB.RMS.TAB002.D110721.UNLOAD|2011-07-21 17:53:47|
but now my requirement has changed and my output file should have data like
9|20110721|DPSIT4B.ABPDB.RMS.TAB002.D110721.UNLOAD|2011-07-21 17:53:47|
if the count is 12345, then the count should have this value.(count can vary from 1 to 10 digits)
and one more difference is the Date without "-", for acheiving this i used below sort card
OPTION COPY
INREC BUILD=(DATE1,TIME1,80:X)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(2,8,'|')
is there any other way to acheive this date format
Pls help
i used the below job and created a file
//STEP2 EXEC PGM=SORT,PARM='CTL"DPSIT4B.&MLQ..TAB002.D&ODATE..UNLOAD"'
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTIN DD DSN=DBRDB.ABPDB.RMS.TAB002.D&ODATE..UNLOAD,DISP=SHR
//SORTOUT DD DSN=&HLQ..&MLQ..TAB002.D&ODATE..CTL,
// SPACE=(CYL,(150,100),RLSE),
// DCB=(LRECL=82,RECFM=FB),
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=10),'|',DATE=(4MD-),'|',
CTL,'|',DATE=(4MD-),X,TIME=(24:))
my output file has the record
0000000009|2011-07-21|DPSIT4B.ABPDB.RMS.TAB002.D110721.UNLOAD|2011-07-21 17:53:47|
but now my requirement has changed and my output file should have data like
9|20110721|DPSIT4B.ABPDB.RMS.TAB002.D110721.UNLOAD|2011-07-21 17:53:47|
if the count is 12345, then the count should have this value.(count can vary from 1 to 10 digits)
and one more difference is the Date without "-", for acheiving this i used below sort card
OPTION COPY
INREC BUILD=(DATE1,TIME1,80:X)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(2,8,'|')
is there any other way to acheive this date format
Pls help
Thanks,
Ganesh.
Ganesh.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can't use CTL as the symbol name in PARM. You have to use JPn (e.g. JP1).
Here's a DFSORT/ICETOOL that will do what I think you're asking for:
Here's a DFSORT/ICETOOL that will do what I think you're asking for:
Code: Select all
//STEP2 EXEC PGM=ICETOOL,
// PARM='JP1"DPSIT4B.&MLQ..TAB002.D&ODATE..UNLOAD"'
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=DBRDB.ABPDB.RMS.TAB002.D&ODATE..UNLOAD,DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD DSN=&HLQ..&MLQ..TAB002.D&ODATE..CTL,
// SPACE=(CYL,(150,100),RLSE),
// DCB=(LRECL=82,RECFM=FB),
// DISP=(NEW,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
BUILD=(82:X),
TRAILER1=(COUNT=(M10,LENGTH=10),'|',DATENS=(4MD),'|',
JP1,'|',DATE=(4MD-),X,TIME=(24:))
//CTL2CNTL DD *
INREC BUILD=(1,82,JFY=(SHIFT=LEFT))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page