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

Extracting a value and putting it in a header


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Wed Aug 20, 2008 10:28 pm
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
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
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: 2481
Location: @my desk

PostPosted: Wed Aug 20, 2008 11:36 pm
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: 2481
Location: @my desk

PostPosted: Thu Aug 21, 2008 12:26 am
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 Developer


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

PostPosted: Thu Aug 21, 2008 12:49 am
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: 2481
Location: @my desk

PostPosted: Thu Aug 21, 2008 1:03 am
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
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: 2481
Location: @my desk

PostPosted: Fri Aug 22, 2008 10:12 pm
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 Developer


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

PostPosted: Fri Aug 22, 2008 10:48 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Help in extracting data between doubl... DFSORT/ICETOOL 5
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
No new posts Extracting Compression Statistics fro... PL/I & Assembler 2
Search our Forums:

Back to Top