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

regarding passing a file from sysin dd


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ipavan

New User


Joined: 12 Jun 2005
Posts: 28
Location: Hyderabad

PostPosted: Thu Jul 21, 2005 6:24 pm
Reply with quote

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
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Thu Jul 21, 2005 11:00 pm
Reply with quote

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
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Fri Jul 22, 2005 12:40 am
Reply with quote

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
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top