Is it possible to add timestamp in the Header Record?

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Is it possible to add timestamp in the Header Record?

Post by sganesh_85 » Thu Jun 16, 2011 2:27 pm

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?
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jun 16, 2011 9:45 pm

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:

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))                 
SORTOUT would have:

Code: Select all

HDR-Invoice-2011/06/16 09:44:40     
aaaa                                
bbbb                                
ccccc                               
TRL-00000003                        
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
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

sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Post by sganesh_85 » Fri Jun 17, 2011 11:12 am

Hi Frank,

Thank a lot!!!
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..

Thanks once again..
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Jun 17, 2011 9:46 pm

I am really surprised to see this quick reply.
I monitor this Forum (and DFSORT Forums on several other help boards) all day at work.
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

sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Post by sganesh_85 » Tue Jul 19, 2011 3:49 pm

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
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jul 19, 2011 9:42 pm

The only difference I see is a - instead of / for the date, so you would use:

Code: Select all

  DATE=(4MD-),X,TIME=(24:)
Am I missing something?
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

sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Post by sganesh_85 » Wed Jul 20, 2011 11:25 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


--
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jul 21, 2011 12:28 am

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

sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Post by sganesh_85 » Thu Jul 21, 2011 10:19 am

Hi Frank,

you are really Great!!!
the code is working excellent for my requirement.

Thank you very much Frank!!

your response is really quick and accurate!!
Thanks,
Ganesh.

sganesh_85
Member
Posts: 14
Joined: Thu Jun 16, 2011 10:18 am

Post by sganesh_85 » Mon Jul 25, 2011 3:22 pm

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
Thanks,
Ganesh.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jul 26, 2011 1:21 am

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:

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

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 9:59 pm

<< Content deleted By Admin >>

Post Reply

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



Other References
Mainframe Tools and others