Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
LRECL parameter in Dynamic Allocation routine.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Thu Jun 25, 2009 5:42 am    Post subject: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Hello All -

Can someone help me out by saying how to give the LRECL parameter in the Dynamic allocation routine.

I am passing the below parameter in my dynamic allocation routine, but it allocating the files with default LRECL of 80 whereas I need to allocate the files only with LRECL of 50. I tried by giving the LRECL value as,
10 PIC X(12) VALUE ' LRECL(50) ' , but I was getting error saying the invalid parameter. So, I just wanted to know the correct format for it.

Your response is greatly appreciated.

01 WS-DYNAMIC-ALLOC-STORAGE.
05 ENV-VAR-PARM-PASSED.
10 DDNAME PIC X(08) VALUE SPACES.
10 PIC X(05) VALUE '=DSN('.
10 DSNAME PIC X(50) VALUE SPACE.
10 PIC X(14) VALUE ' NEW CATALOG '.
10 PIC X(23) VALUE ' SPACE(10,5) TRACKS '.
10 PIC X(17) VALUE ' UNIT(SYSDA) '.
10 PIC X(01) VALUE X'00'.
05 PUTVAR-PARM-PTR POINTER.
05 RC PIC S9(9) BINARY VALUE +0.

Regards!
Arun
Back to top
View user's profile Send private message
References
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4057
Location: Charlotte,NC USA

PostPosted: Thu Jun 25, 2009 6:18 am    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Are you using the BPXWDYN routine or a standard TSO ALLOCATE command?
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Thu Jun 25, 2009 6:30 am    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Hi -
I am using 'PUTENV' to pass the ENV-VAR-PARM-PASSED. I didnt try by using BPXWDYN.

Your response in any form in terms of giving the LRECL in the passed parameter would be appreciated. Thanks!
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 13592
Location: 221 B Baker St

PostPosted: Thu Jun 25, 2009 7:28 am    Post subject:
Reply with quote

Hello,

Once you have called PUTENV to identify the DD, you then issue an OPEN for the file (FD)?

If so, the lrecl would be taken from the FD. . .?
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Fri Jun 26, 2009 12:39 am    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Hi Dick!

Even I presumed that way i.e. the LRECL would be taken from FD but, when I tried by giving the LRECL as 50 in my FD, my job was getting failed with error code of 39 [discrepany in the LRECL] and the error says that there is discrepany between the LRECL in the program( it is 50) and in the dynamic allocation(defaults allocation with LRECL 80).

Thatz where I got stuck and not able to proceed further. I tried couple of different methods of giving the LRECL in the Dynamic allocation routine, but everytime I was getting "Invalid keyword".

Would be great if someone could share their experience if you have already faced such a situation. Thanks a lot!
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 316
Location: Deerfield IL

PostPosted: Sat Jun 27, 2009 2:39 am    Post subject:
Reply with quote

I had only tried dynamic allocation for my input files. I am getting the same result you have for a dynamically allocated output file. Have you tried using IKJTSOEV and IKJEFTSR? They should work (but I have not tried it yet).
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Thu Jul 02, 2009 5:01 pm    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Hi Doug! No I didn't try using IKJTSOEV and IKJEFTSR as I have no clue how to go about that...

Any other response from other folks would be greatly appreciated. I gave a good search in this forum and happen to find out one of the user ('adiovanni ') had given some solution to similar request. I tried that by changing the RECORDIND MODE, BLOCK CONTAINS.......but nothing paid me. :-( :(

Hi adiovanni - Would be great if you could throw some light on my request. All I want is to pass the LRECL of 50 from Dynamic routine because in my pgm i have my FD with 50. Its taking the system default LRELC of 80 which is causing my pgm to get abend with status code 39.

I am totally stuck on this. Any response in any form is greatly appreciated.

Thanks a lot!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 3385
Location: germany

PostPosted: Thu Jul 02, 2009 5:19 pm    Post subject:
Reply with quote

80 char is a minimum for a lot of things. Maybe, here also.
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Thu Jul 02, 2009 5:52 pm    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Yep thatz true!....but in my case I wanted the LRECL to be 50.... I am not able to override the system provided LRECL with my value....so, trying out the different possibilities.....any other suggestions from other folks?......Thanks!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 4256
Location: Atlanta, GA

PostPosted: Thu Jul 02, 2009 6:03 pm    Post subject:
Reply with quote

From what I can tell, the PUTENV method does not support LRECL -- so if you're defining a new file, PUTENV probably is not the way to go. Using BPXWDYN allows you to specify the LRECL as part of the allocation.
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Thu Jul 02, 2009 6:12 pm    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Thanks for your comments Robert! Yes I am going to give a try by using BPXWDYN routine.

In the meanwhile, if any of the other forum folks have the sample of BPXWDYN routine, could you please pass it across???

Your response is greatly appreciated. Thanks a ton!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 4256
Location: Atlanta, GA

PostPosted: Thu Jul 02, 2009 8:43 pm    Post subject:
Reply with quote

Code:
       FILE-CONTROL.
           SELECT OUT-FILE             ASSIGN TO OUTFILE
                                       FILE STATUS IS OUT-FILE-FS
                                       .
       DATA DIVISION.
       FILE SECTION.
       FD  OUT-FILE
           BLOCK 0
           RECORDING F
           LABEL RECORDS STANDARD.
       01  OUT-FILE-REC PIC X(50).

       WORKING-STORAGE SECTION.
       01  WS-VARIABLES.
           05  BPXWDYN-ALLOC.
               10  FILLER              PIC X(42) VALUE
               'ALLOC FI(OUTFILE) DA(TTSSRS0.BPXWDYN.TEXT)'.
               10  FILLER              PIC X(12) VALUE
               ' NEW CATALOG'.
               10  FILLER              PIC X(46) VALUE
               ' SPACE(1,1) CYL LRECL(50) BLKSIZE(0) RECFM(FB)'.
               10  FILLER              PIC X(12) VALUE
               ' UNIT(SYSDA)'.

       01  BPXWDYN-RC                  PIC S9(08) COMP-5.

       01  OUT-FILE-FS                 PIC 9(02) VALUE 00.

       01  WS-SUB-PROG                 PIC X(08) VALUE 'BPXWDYN '.
      /
       PROCEDURE DIVISION.
       S1000-MAIN       SECTION.
           CALL WS-SUB-PROG
               USING WS-VARIABLES
               RETURNING BPXWDYN-RC.
           DISPLAY 'BPXWDYN RC = ' BPXWDYN-RC.
           OPEN OUTPUT OUT-FILE.
           DISPLAY 'OPEN  FILE STATUS = ' OUT-FILE-FS.
           MOVE ALL 'ABCDE0001'        TO  OUT-FILE-REC.
           WRITE OUT-FILE-REC.
           DISPLAY 'WRITE FILE STATUS = ' OUT-FILE-FS.
           MOVE ALL 'ZYXWV9999'        TO  OUT-FILE-REC.
           WRITE OUT-FILE-REC.
           DISPLAY 'WRITE FILE STATUS = ' OUT-FILE-FS.
           CLOSE OUT-FILE.
           DISPLAY 'CLOSE FILE STATUS = ' OUT-FILE-FS.
           STOP RUN.
allocates the file
Code:
Data Set Name . . . . : TTSSRS0.BPXWDYN.TEXT

General Data                           Current Allocation
 Management class . . : MCSTRG          Allocated cylinders : 1
 Storage class  . . . : SCSTRG          Allocated extents . : 1
  Volume serial . . . : STRS13
  Device type . . . . : 3390
 Data class . . . . . : DCNOORG        Current Utilization
  Organization  . . . : PS              Used cylinders  . . : 1
  Record format . . . : F               Used extents  . . . : 1
  Record length . . . : 50
  Block size  . . . . : 50
  1st extent cylinders: 1
  Secondary cylinders : 1
  Data set name type  :                 SMS Compressible  :   NO

  Creation date . . . : 2009/07/02      Referenced date . . : 2009/07/02
  Expiration date . . : ***None***
with contents
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
ABCDE0001ABCDE0001ABCDE0001ABCDE0001ABCDE0001ABCDE
ZYXWV9999ZYXWV9999ZYXWV9999ZYXWV9999ZYXWV9999ZYXWV
and the JCL that executed was
Code:
//STEP1     EXEC PGM=MF0084
//STEPLIB   DD   DISP=SHR,DSN=TTSSRS0.COMPILES.LOADLIB
//

Notes:
1. The data set name does not have tic marks around it but is fully qualified. I ran one without my TSO user id and got the data set cataloged in the master catalog (not what I wanted) since my user id can do that; most users would get abends at that point.
2. Checking the return code is highly recommended -- and the BPXWDYN return code is a COMP-5 (4-byte binary) field.
3. The passed parameter is not a null-terminated string as with C code.
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Fri Jul 03, 2009 6:30 pm    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Thanks for your post Robert! Yes I am trying out the dynamic allocation using BPXWDYN routine. Would keep you posted. Thanks again!
Back to top
View user's profile Send private message
ArunAnbu

New User


Joined: 15 Jun 2009
Posts: 17
Location: India

PostPosted: Fri Jul 03, 2009 7:50 pm    Post subject: Reply to: LRECL parameter in Dynamic Allocation routine.
Reply with quote

Hi Robert!

Yeah i tried your code by hard coding the output dataset, its working fine and allocating the DS with LRECL 50.

But for my requirement I need to read the data from another input file and pass the DSN and also write into the dynamically allocated file. When I tried so, i was getting different RC from the BPXWDYN call.

I tried different methods, but nothing paid me. So, I just wanted to know whether BPXWDYN will work when the DSN comes from a different means?.....if so, the could you please tell me how to handle it in the pgm?...

Below is the error msg from the spool.
BPXWDYN RC = 176082124Q
OPEN FILE STATUS = 96
CEE3204S The system detected a protection exception (System Completion Code=0C4
From compile unit DYNALLTS at entry point DYNALLTS at statement 123 at
entry offset +000007C0 at address 16101718.

Below is my two select [input and output file]:
SELECT IN-FILE ASSIGN TO INFILE
FILE STATUS IS IN-FILE-FS.

SELECT OUT-FILE ASSIGN TO OUTFILE
FILE STATUS IS OUT-FILE-FS.

Thanks for your response!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 4256
Location: Atlanta, GA

PostPosted: Sat Jul 04, 2009 2:58 am    Post subject:
Reply with quote

You are probably not allowing for the different lengths of the data set name in the correct way. I have tested this code and it works:
Code:
           SELECT IN-FILE              ASSIGN TO INFILE
                                       FILE STATUS IS IN-FILE-FS
                                       .
           SELECT OUT-FILE             ASSIGN TO OUTFILE
                                       FILE STATUS IS OUT-FILE-FS
                                       .
       DATA DIVISION.
       FILE SECTION.
       FD  IN-FILE
           BLOCK 0
           RECORDING F
           LABEL RECORDS STANDARD.
       01  IN-RECORD.
           05  IN-DSN                  PIC X(44).
           05  FILLER                  PIC X(36).

       FD  OUT-FILE
           BLOCK 0
           RECORDING F
           LABEL RECORDS STANDARD.
       01  OUT-FILE-REC PIC X(50).

       WORKING-STORAGE SECTION.
       01  WS-VARIABLES.
           05  BPXWDYN-ALLOC.
               10  BPXWDYN-1           PIC X(21) VALUE
               'ALLOC FI(OUTFILE) DA('.
               10  BPXWDYN-2           PIC X(14) VALUE
               ')  NEW CATALOG'.
               10  BPXWDYN-3           PIC X(46) VALUE
               ' SPACE(1,1) CYL LRECL(50) BLKSIZE(0) RECFM(FB)'.
               10  BPXWDYN-4           PIC X(12) VALUE
               ' UNIT(SYSDA)'.
       01  BPXWDYN-RC                  PIC S9(08) COMP-5.

       01  OUT-FILE-FS                 PIC 9(02) VALUE 00.

       01  IN-FILE-FS                  PIC 9(02) VALUE 00.

       01  WS-SUB-PROG                 PIC X(08) VALUE 'BPXWDYN '.

       01  WS-BPXWDYN-STRING           PIC X(255) VALUE SPACES.
      /
       PROCEDURE DIVISION.
       S1000-MAIN       SECTION.
           OPEN INPUT IN-FILE.
           DISPLAY 'OPEN IN-FILE FS = ' IN-FILE-FS.
           READ IN-FILE.
           DISPLAY 'READ IN-FILE FS = ' IN-FILE-FS.
           STRING BPXWDYN-1 DELIMITED BY SIZE
                  IN-DSN    DELIMITED BY SPACE
                  BPXWDYN-2 DELIMITED BY SIZE
                  BPXWDYN-3 DELIMITED BY SIZE
                  BPXWDYN-4 DELIMITED BY SIZE
             INTO WS-BPXWDYN-STRING.
           CLOSE IN-FILE.
           DISPLAY WS-BPXWDYN-STRING.
           CALL WS-SUB-PROG
               USING WS-BPXWDYN-STRING
               RETURNING BPXWDYN-RC.
           DISPLAY 'BPXWDYN RC = ' BPXWDYN-RC.
           OPEN OUTPUT OUT-FILE.
           DISPLAY 'OPEN  FILE STATUS = ' OUT-FILE-FS.
           MOVE ALL 'ABCDE0001'        TO  OUT-FILE-REC.
           WRITE OUT-FILE-REC.
           DISPLAY 'WRITE FILE STATUS = ' OUT-FILE-FS.
           MOVE ALL 'ZYXWV9999'        TO  OUT-FILE-REC.
           WRITE OUT-FILE-REC.
           DISPLAY 'WRITE FILE STATUS = ' OUT-FILE-FS.
           CLOSE OUT-FILE.
           DISPLAY 'CLOSE FILE STATUS = ' OUT-FILE-FS.
           STOP RUN.
In the execution JCL I gave earlier, I added
Code:
//INFILE   DD   *
TTSSRS0.BPXWDYN.TEXT
/*
You could make the amount of space allocated variable by using a string function on it as well (trivial modification to this code). The BPXWDYN allocation string has spaces between keywords but cannot have any spaces within a keyword or you'll get an error.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 HoursGoto page 1, 2  Next
Page 1 of 2