Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extracting a value and putting it in a header

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
RahmanisGod

New User


Joined: 12 Aug 2008
Posts: 7
Location: Chennai, India

PostPosted: Wed Aug 20, 2008 9:59 pm    Post subject: Extracting a value and putting it in a header
Reply with quote

Hi all,

I have been challenged with a serious problem.

I have a file which contains the date field starting at postion 128 and is 10 byte long as shown below.

XXXXXXXXXXXXXXXX YYYY/MM/DD

I need to extract the data from the above file and put it in the header section of another file .The header is a pagewise header and hence I have to use the HEADER2 function. The date is in the same postion in the header record as it is in the input file (128,10).

the outputfile should look like

XXXXXXXXXXXXXXXX YYYY/MM/DD (HEADER)
RECORD 1
RECORD 2
RECORD 3
...........
..........
XXXXXXXXXXXXXXXX YYYY/MM/DD
RECORD 1
RECORD 2
RECORD 3
...........
..........

I only need to extract the value from a field and pass it to the header statement .Please help me ASAP

HEADER2=(1:'XXXX',128:????)

How do I perform this operation??? Can it be done using the PARSE function???
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Wed Aug 20, 2008 10:28 pm    Post subject:
Reply with quote

Quote:
I need to extract the data from the above file


Is there any way to identify the record you want to extract from file-1?

Thanks,
Arun
Back to top
View user's profile Send private message
RahmanisGod

New User


Joined: 12 Aug 2008
Posts: 7
Location: Chennai, India

PostPosted: Wed Aug 20, 2008 10:54 pm    Post subject: Reply to: Extracting a value and putting it in a header
Reply with quote

Yes the record containing date is the first record in my input file which starts at 128 and is 10 bytes long.
Back to top
View user's profile Send private message
RahmanisGod

New User


Joined: 12 Aug 2008
Posts: 7
Location: Chennai, India

PostPosted: Wed Aug 20, 2008 11:17 pm    Post subject:
Reply with quote

To be more specific the first record in the input file contains the date at position 128, the date field is 10 bytes long and the record starts with the string "HEADER"

I jus need a way by which I can extract the date from the above file, and pass it onto another file's header.

Is there any method by which any of the following operations is possible.

>> Extracting the date from the input file using a sort card
>> Passing on the date value to another sort card creating the pagewise header.

or

>> Using a sort card to read the date from the input file and insert in all instances where header occurs in the output file.

Please note that the OUTPUT file's header record also starts with teh string HEADER
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Wed Aug 20, 2008 11:36 pm    Post subject:
Reply with quote

What are the LRECL/RECFM of the files?

Thanks,
Arun
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Thu Aug 21, 2008 12:26 am    Post subject:
Reply with quote

RahmanisGod,

Are the headers in both the files exactly the same except the date field?
Do you have more than one record in file-1 having the value 'HEADER' in pos-1?

Thanks,
Arun
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 21, 2008 12:49 am    Post subject:
Reply with quote

RG,

Here's a DFSORT job that will do what you want. It creates a DFSORT symbol with the date from file1 and uses that symbol in HEADER2 for file2.
I assumed your input files have RECFM=FB but the job can be changed appropriately for RECFM=VB files.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY,STOPAFT=1
  INREC BUILD=(C'TDATE,''',128,10,C'''',80:X)
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2 (FB)
//SORTOUT DD DSN=...  output file (FB)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL HEADER2=(1:'XXXX',128:TDATE)
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Thu Aug 21, 2008 1:03 am    Post subject:
Reply with quote

RahmanisGod,

You may try this too.

Code:
//STEP00   EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD DSN=input.file1                                   
//IN2      DD DSN=input.file2                                   
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//C1       DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT      DD DSN=output.file                                   
//TOOLIN   DD *                                                 
COPY FROM(IN1) TO(C1)  USING(CTL1)                             
COPY FROM(IN2) TO(OUT) USING(CTL2)                             
//CTL1CNTL DD *                                                 
   OPTION COPY,STOPAFT=1                                       
   OUTREC BUILD=(C'    128:C''',128,10,C''')',80:X)             
//CTL2CNTL DD *                                                 
   OUTFIL FNAMES=OUT,HEADER2=(C'HEADER XXXXXXXXXXXXXXXXXXX ',             
//         DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)             


Thanks,
Arun
Back to top
View user's profile Send private message
RahmanisGod

New User


Joined: 12 Aug 2008
Posts: 7
Location: Chennai, India

PostPosted: Thu Aug 21, 2008 12:30 pm    Post subject:
Reply with quote

Thanks a lot guys..... It worked like a charm. I settled for Frank's solution because it was quiker and suited my problem better.


This forum rocks!! Waiting for my day in the sun...

icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Fri Aug 22, 2008 10:12 pm    Post subject:
Reply with quote

Quote:
I settled for Frank's solution because it was quiker

Frank

Any guess for the difference in performance? What did you do to SYMNAMES to make it run faster? icon_biggrin.gif

Thanks,
Arun
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Aug 22, 2008 10:48 pm    Post subject:
Reply with quote

Quote:
Frank

Any guess for the difference in performance? What did you do to SYMNAMES to make it run faster?


The performance of the two methods would be the same. The processing for SYMNAMES is negligible.

I prefer the SYMNAMES method because it doesn't require generating the actual DFSORT control statements - it allows you to set up the DFSORT control statements as you normally would and just substitute the symbol where you need it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am
No new posts Extracting Information from DD Statem... Charles Wolters All Other Mainframe Topics 7 Wed Apr 13, 2016 10:21 pm
No new posts Remove header only knobi SYNCSORT 5 Mon Feb 15, 2016 10:42 pm
No new posts GROUP - header data to be repeated in... Musab Ahmed DFSORT/ICETOOL 3 Mon Feb 01, 2016 11:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us