IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can Date and Time be put together in Header?&TIME vs. &a


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balimanja

New User


Joined: 14 Aug 2007
Posts: 40
Location: Bangalore

PostPosted: Wed Aug 29, 2007 12:55 pm
Reply with quote

Hi All,

The requirement is as follows:

0200708291244 <-----HEADER(DATE AS YYYYMMDD & TIME AS HHMM)
1AAAAAAAAAAAAAAA
1BBBBBBBBBBBBBBB
1CCCCCCCCCCCCC
900000003 <-----TRAILER(COUNT)

So far this is what I had tried with:

OUTFIL REMOVECC,HEADER1=(1:C'0',2:&DATENS=(4MD),10:&TIME2)

I used &TIME2 since my requirement says so. But on using &TIME2, I get a syntax error as:

OUTFIL REMOVECC,HEADER1=(1:C'0',2:&DATENS=(4MD),10:&TIME2)

at the comma between 2:&DATENS=(4MD) and 10:&TIME2

By using &TIME the header appears successfully but not as per my needs.

Why is this difference between &TIME and &TIME2 and how to satisfy my above requirement??

Thank You ALL for your time on this.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Aug 29, 2007 2:26 pm
Reply with quote

Please post yout output with the error.....
Back to top
View user's profile Send private message
SCANDY

New User


Joined: 08 Aug 2007
Posts: 10
Location: Dalian, China

PostPosted: Wed Aug 29, 2007 6:17 pm
Reply with quote

from the syntax of OUTFIL, it seems you cannot use TIME2 in HEADERn and TRAILERn, but you can use them in BUILD and OUTREC.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Aug 30, 2007 1:53 pm
Reply with quote

balimanja
Check this link for for the formats to be used and there descriprions
OUTFIL Control Statements
Quote:
Why is this difference between &TIME and &TIME2 and how to satisfy my above requirement??

There is no time syntax like &TIME2.
May be after checking the above link you will be comfortable about the formats/syntaxes to be used.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 40
Location: Bangalore

PostPosted: Thu Aug 30, 2007 4:25 pm
Reply with quote

Scandy,

THANK YOU.Basically my requirement is to add a header that contains a '0' followed by DATE(YYYYMMDD) followed by TIME(HHMM).

E.g.:

0200708301625
DETAILRECORDS
DETAILRECORDS
DETAILRECORDS
DETAILRECORDS
DETAILRECORDS
DETAILRECORDS
TRAILER

Sine I need TIME in HHMM format after DATE I had to use &TIME2 but there seems to be a problem with it.

Is there any alternative to add a header as per my req.?

THANK YOU
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Aug 30, 2007 5:34 pm
Reply with quote

balimanja
Use this ICETOOL solution for your requirement.
Note that the O/p file OUT has DISP=MOD
Code:
//*******************************************************
//STEP001  EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN1      DD *                                         
                                                         
/*                                                       
//IN2      DD *                                         
DETAILRECORDS                                           
DETAILRECORDS                                           
DETAILRECORDS                                           
DETAILRECORDS                                           
DETAILRECORDS                                           
DETAILRECORDS                                           
/*                                                       
//OUT      DD DSN=O/P FILE... DISP=MOD                   
//TOOLIN   DD *                                         
 COPY FROM(IN1)   TO(OUT) USING(CP01)                   
 COPY FROM(IN2)   TO(OUT)  USING(CP02)                   
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTREC OVERLAY=(C'0',2:DATE1,10:TIME2)                               
/*                                                                     
//CP02CNTL DD   *                                                       
   OUTFIL REMOVECC,                                                     
   TRAILER1=(C'9',2:COUNT-1=(M11,LENGTH=8))                             
/*                                                                     
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 31, 2007 4:49 am
Reply with quote

balimanja,

Here's a better way to do what you want with DFSORT (one pass). I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1AAAAAAAAAAAAAAA
1BBBBBBBBBBBBBBB
1CCCCCCCCCCCCC
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
    IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,1),
      BUILD=(C'0',DATE1,TIME2,/,1,80)),
    TRAILER1=(C'9',COUNT=(M11,LENGTH=8))
/*
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 40
Location: Bangalore

PostPosted: Mon Sep 03, 2007 1:28 pm
Reply with quote

Thanks Frank, Krisprem, SCANDY, CICs guy.

Thank You ALL
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 40
Location: Bangalore

PostPosted: Tue Sep 18, 2007 5:05 pm
Reply with quote

Sorry to have pulled up this topic.

Frank, as I was testing, I noticed that the header does not appear if there are no records in the file. Can you suggest a solution to this?

Thank You,
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Sep 18, 2007 8:48 pm
Reply with quote

balimanja

Quote:
Frank, as I was testing, I noticed that the header does not appear if there are no records in the file. Can you suggest a solution to this?

You can use my solution, it works even if there are no i/p record's.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Sep 18, 2007 10:08 pm
Reply with quote

balimanja,

Quote:
Frank, as I was testing, I noticed that the header does not appear if there are no records in the file. Can you suggest a solution to this?


Yes. Here's a one-pass DFSORT solution for that situation:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
DUMMY
//       DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
    IFTHEN=(WHEN=(1,5,CH,EQ,C'DUMMY'),
      BUILD=(C'0',DATE1,TIME2)),
    TRAILER1=(C'9',COUNT-1=(M11,LENGTH=8))
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Sep 18, 2007 10:09 pm
Reply with quote

Krisprems,

In your job, wouldn't you want the following for the OUTFIL statement to get the correct count of data records:

Code:

   OUTFIL FNAMES=OUT,REMOVECC,             
   TRAILER1=(C'9',2:COUNT=(M11,LENGTH=8)) 


Since your second COPY operator only deals with the detail records, why would you want COUNT-1 instead of COUNT?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Sep 20, 2007 9:23 pm
Reply with quote

Quote:
Since your second COPY operator only deals with the detail records, why would you want COUNT-1 instead of COUNT?

Yes, you are right frank, i need not use COUNT-1.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts Pull data using date difference betwe... DB2 6
Search our Forums:

Back to Top