View previous topic :: View next topic
|
Author |
Message |
ipavan
New User
Joined: 12 Jun 2005 Posts: 28 Location: Hyderabad
|
|
|
|
hi priyesh,
i am coding
// sysin dd *
lib'xxxx.yyy.zzzz'
//
this is a ps file . i want to access the data present in ps file. how to do that in the cobol program. |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi ipavan!
We can't access the data inside the PS file, if we give that in SYSIN DD *. Why can't you use that as an input file. |
|
Back to top |
|
|
die7nadal
Active User
Joined: 23 Mar 2005 Posts: 156
|
|
|
|
Priyesh,
U can acess it if you are able to allocate it dynamically by calling Assemler routine DYNALLOC or by passing values to Language Environment Variable.
Below is the code to accept a file from SYSIN and allocate the file by passing the value to the Language Environment Variable and write a record to the file.
Code: |
* DYNAMICALLY ALLOCATING DATASET USING LANG ENVIRONMENT
* THIS PROGRAM SHOULD BE COMPILED WITH A NODYNAM OPTION
* THE C MODULE SOULD BE CALLED STATICALLY
IDENTIFICATION DIVISION.
PROGRAM-ID. DYNAM1.
AUTHOR. XXXXX.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO DYNAFILE
FILE STATUS IS DYN-STATUS.
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS.
01 INPUT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 ADDRESS-POINTER POINTER.
01 FILE-ENVIRONMENT-VAR.
05 FILE-ENVIRONMENT-VAR1 PIC X(13) VALUE "DYNAFILE=DSN(".
05 FILE-ENVIRONMENT-VAR2 PIC X(15) VALUE SPACES.
05 FILE-ENVIRONMENT-VAR3 PIC X(07) VALUE ") MOD ".
01 DYN-STATUS PIC 9(02).
01 RC PIC 9(09) BINARY VALUE 0.
PROCEDURE DIVISION.
ACCEPT FILE-ENVIRONMENT-VAR2 FROM SYSIN.
SET ADDRESS-POINTER TO ADDRESS OF FILE-ENVIRONMENT-VAR.
CALL "PUTENV" USING BY VALUE ADDRESS-POINTER RETURNING
RC .
IF RC IS EQUAL TO ZERO
DISPLAY ' GOOD '
ELSE
DISPLAY ' BAD '
STOP RUN.
OPEN OUTPUT INPUT-FILE.
MOVE ' FUNNY ' TO INPUT-RECORD.
WRITE INPUT-RECORD.
CLOSE INPUT-FILE.
STOP RUN.
|
I have coded to accept this
Code: |
//SYSIN DD *
MNT7.VA.TEST.#4 |
as the Instream Data, but u may have to edit the variable if you pass other data along with the DSN and put it in the Environment Variable. Also compile the pgm with NODYNAM option. |
|
Back to top |
|
|
|