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

Dynamic File Allocation in Easytrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Apr 03, 2012 6:53 pm
Reply with quote

Hi All,

I am trying to allocate file dynamically using below easytrieve code:

Code:
  FILE INFILE FB (80 0)                     
  IN-REC         001  080  A               
  IN-REC1        001  040  A               
*                                           
  FILE OTFILE  FB (80 0)                   
  OT-REC         001  080  A               
  OT-REC32       001  040  A               
*                                           
 PGM  W  08 A VALUE 'BPXWDYN'               
 FS   W  02 A                               
 FN   W  16 A                               
 WS-ALLOC-STRING  W  100 A                 
 WS-A      WS-ALLOC-STRING    1 A OCCURS 100
*                                           
JOB INPUT INFILE                                             
*                                                             
   MOVE 'HLQ1.HLQ2.DYN' TO FN                               
   WS-ALLOC-STRING = 'ALLOC DD(OTFILE) DSN('''                 
   MOVE FN TO WS-A(23) 16                                     
   MOVE ''') NEW CATALOG LRECL(80) RECFM(F,B)' TO WS-A(39) 35 
   DISPLAY WS-ALLOC-STRING                                     
   CALL BPXWDYN USING WS-ALLOC-STRING                         
   OT-REC32 = IN-REC1                                         
   DISPLAY OT-REC32                                           
   PUT OTFILE                                                 
   STOP                                                       


When I execute the above program I am getting following error

Code:

19 *******A001 FILE OPEN ERROR - OTFILE                     
   *******A014 PREMATURE TERMINATION DUE TO PREVIOUS ERROR(S)


Can anyone help in this regard.

Thanks in advance.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 03, 2012 7:03 pm
Reply with quote

I guess what you are trying to do doesn't work as you have it.

Should it work in theory? I don't know. Have you checked the value of the string you are building and that everything is OK there?

What are you trying to do?

Have you considered using a FILE EXIT? This would allow you to have a (say, Cobol) program which controls the processing of that file, with Easytrieve calling that program with the data. Then, if you have something which "works" in, say, Cobol, then'll it'll work (likely) in that program.

Since you've had a go at reference-modification in Easytrieve, I'm sure you can find the file exit references in the manual.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Apr 03, 2012 7:11 pm
Reply with quote

Hi Bill,

Thanks for your quick reply.

File got created when I commented below lines,

Code:
   OT-REC32 = IN-REC1                                         
   DISPLAY OT-REC32                                           
   PUT OTFILE   


But I am not able to write to the file after allocating.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 03, 2012 7:30 pm
Reply with quote

OK. As I said, I don't know if what you are trying to do will work. Not too big a chance that anyone here has done it (asking for trouble).

Two choices then.

  • Call CA support and ask if it should work/see if they have an Easytrieve forum where you can ask
  • Look at the File EXIT
  • There are always three things
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 03, 2012 11:03 pm
Reply with quote

Hello,

Why not simply allocate the output file in the jcl?

If you need the dataset name to be resolved at runtime, use a symbolic parameter in the jcl.

Possibly i misunderstand. . .
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed Apr 04, 2012 12:52 pm
Reply with quote

Hi Dick,

My requirement is I need to process a sorted file on 1 to 7 positions.

I need to update some of the data from 150 position. After that I need write the record to output file. Once I encounter a new value on 1 to 7 positions I need create new output file.

Simply, I need to create multiple output files by grouping the data on 1 to 7 positions from the input file.

Can anyone suggest me? I am looking into Bill's suggestion.

Thanks!
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Apr 04, 2012 1:08 pm
Reply with quote

Try this :

FILE OTFILE
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 04, 2012 1:12 pm
Reply with quote

Are the file names entirely "dynamic" or is there some reasonable sub-set of infinity for them?

For instance, if there is a maximum of, say, 20, you could code it out in the program and JCL, either in Easytrieve or your sort product.

However, if one day there are four, and the next there might be 1,000, that's a different thing.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed Apr 04, 2012 3:45 pm
Reply with quote

Hi Bill,

File names are entirely dynamic.

Since no control on the input data I am left with no option.

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 04, 2012 8:52 pm
Reply with quote

Hello,

If this is needed quickly, you might consider using COBOL.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 04, 2012 10:50 pm
Reply with quote

I thought I'd posted this.

A File Exit, in Cobol, in really simple to do. You do all the IO, in your case ncluding multiple closes and dynamic assignments and opens, plus the writing to whatever happens to be the current file., Easytrieve calls your program whien it wants to do IO and doesn't have to know anything about the "complexity".
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top