Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

File Handling in JCL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Fri Jan 27, 2006 10:21 am    Post subject: File Handling in JCL
Reply with quote

COBOL program consisting of files. How to execute that program through JCL ?
Back to top
View user's profile Send private message

vikasc4

New User


Joined: 11 Dec 2005
Posts: 32

PostPosted: Fri Jan 27, 2006 10:52 am    Post subject:
Reply with quote

Hi,

For this first you have to use SELECT clause in Cobol program and ASSIGN a DDNAME..
eg.
SELECT FILENAME ASSIGN TO DDI.

and in jcl you have to give this ddname

eg.

STEP1 EXEC PGM=PRM1
DD1 DD DSN=PS.NAME,DISP=SHR

regards

Vikas
Back to top
View user's profile Send private message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Fri Jan 27, 2006 10:57 am    Post subject:
Reply with quote

Hi,
i have used "SELECT" clause with same dd name but still it is giving me error as " DATASET NOT FOUND" .

Regards ,
Nutan.
Back to top
View user's profile Send private message
vikasc4

New User


Joined: 11 Dec 2005
Posts: 32

PostPosted: Fri Jan 27, 2006 11:06 am    Post subject:
Reply with quote

Hi,

First check that you have that data set or not. If not then create it first and then try to run the program.

Also try to check the name of data set if you alredy have that.

Most important that The DDNAMES in both program and jcl must be same.

Regards
Vikas
Back to top
View user's profile Send private message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Fri Jan 27, 2006 11:14 am    Post subject:
Reply with quote

Hi,
I have already created dataset and it is existing . but i am not getting

how to view it or do we need to give entire path of dataset in DSN ? and

how to give it in DSN ?

regards,
Nutan.
Back to top
View user's profile Send private message
vikasc4

New User


Joined: 11 Dec 2005
Posts: 32

PostPosted: Fri Jan 27, 2006 11:26 am    Post subject:
Reply with quote

Yes you have to give the full name of your data set in the DSN.

eg. if your file name is SSS002.NUTAN.PS then you have to give this in the DSN
DD1 DD DSN=SSS002.NUTAN.PS,DISP=SHR

Also you can see your data set by ISPF menu using 3.4 just like you check your other PDS.

Regards
Vikas
Back to top
View user's profile Send private message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Fri Jan 27, 2006 12:59 pm    Post subject:
Reply with quote

hi ,

i have given SELECT stmt with same DDNAME and I am not getting how to give the file name in DSN .

e.g : If my file is "n1.dat" stored in C:\nutan\n1.dat

What will be the SELECT stmt and JCL stmt for this ? Do we need to give extension of file in DSN ?

regards,
Nutan
Back to top
View user's profile Send private message
vikasc4

New User


Joined: 11 Dec 2005
Posts: 32

PostPosted: Fri Jan 27, 2006 3:53 pm    Post subject:
Reply with quote

Hi,
As per my knowledge, the file You are using is window based.

If you want to RUN your cobol program through JCL in Mainframe then you have to follow the following states:

1: You should have a compile JCL to get the error on your code.
2:You should have a RUN jcl to run your program and get the output that your program logic wants.

For the second point (2) : you need to do the following things.

1: In your cobol program i.e ENVIRONMENT DIVISION ,you have to write

SELECT file-name assign to DD1. (for input file)
SELECT file-name assign to DD2. (for output file)

2. change your file C:\nutan\n1.dat to some text file.

3.creat the sequential input file in mainframe and upload text file
data to your mainframe input file.

4.find your RUN JCL and for your output file change the output file DD2 as below.

//STEP1 EXEC PGM= Program-name
//DD1 DD DSN=inputfile.name,DISP=SHR
//DD2 DD DNS=outputfile.output,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),VOL=....,
// DCB=(LRECL=80,RECFM=F,BLKSIZE=800)

IT is just an example ,do the things in your RUN jcl according to your needs.

Regards
Vikas
Back to top
View user's profile Send private message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Fri Jan 27, 2006 4:08 pm    Post subject:
Reply with quote

Hi,

My COBOL prog is :
Code:

           ID DIVISION.
       PROGRAM-ID. FILECOPY1.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT INFILE ASSIGN TO IN1
           ORGANIZATION IS SEQUENTIAL.
           SELECT OUTFILE ASSIGN TO OUT1
           ORGANIZATION IS SEQUENTIAL.
       DATA DIVISION.
       FILE SECTION.
       FD INFILE
           LABEL RECORD ARE STANDARD
           VALUE OF FILE-ID IS 'IN1.DAT'.
       01 IN-REC.
           02 NUM PIC X(80).
       FD OUTFILE
           LABEL RECORD ARE STANDARD
           VALUE OF FILE-ID IS 'OUT1.DAT'.
       01 OUT-REC.
           02 NUM1 PIC X(80).
       WORKING-STORAGE SECTION.
       01 EOF PIC X VALUE IS 'N' .
       PROCEDURE DIVISION.
       MAIN-PARA.
           OPEN INPUT INFILE.
           OPEN OUTPUT OUTFILE.
           READ INFILE INTO OUT-REC AT END MOVE 'Y' TO EOF.
           PERFORM READ-PARA UNTIL EOF = 'Y'.
           CLOSE INFILE
           CLOSE OUTFILE.
           STOP RUN.
       READ-PARA.
           WRITE OUT-REC.
           READ INFILE INTO OUT-REC AT END MOVE 'Y' TO EOF.             .


My JCL stmt is :
Code:

//JOB1 JOB ACNT
//STEP1 EXEC PGM=NEW1
//INPUT1 DD DSN=IN1.DAT,DISP=(SHR,CATLG,CATLG)
//OUTPUT1 DD DSN=OUT1.DAT,DISP=(SHR,CATLG,CATLG)
//


While executing I am getting error msg as "139 Record Length or key data inconsistency " . This error is coming in COBOL program at line " OPEN INPUT INFILE. " I have manually created "IN1.DAT" and "OUT1.DAT".
i have checked record length also . And is it necessary to use text file . Can't we use .DAT file ? I tried by changing DISP parameters also , still facing same error .

Regards ,
Nutan
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Fri Jan 27, 2006 5:38 pm    Post subject: Re: File Handling in JCL
Reply with quote

Hi Nutan,

From My point of view
U have given infile assign to IN1 and outfile assign to OUT1
then u have to give same DD names IN1 and OUT1 at run Jcl
i.e.
at run time u have to give
//IN1 dd dsn=---
//OUT1 dd dsn=----

check it out I think It'll work
regards,
chandan
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jan 27, 2006 7:34 pm    Post subject: Re: File Handling in JCL
Reply with quote

The program compiles fine. If you make the JCL changes as suggested by chandan, then the program runs just fine also.
Back to top
View user's profile Send private message
ravi narayan padhi

New User


Joined: 26 Jan 2006
Posts: 1
Location: delhi

PostPosted: Sat Jan 28, 2006 7:44 pm    Post subject:
Reply with quote

im totally confused about the condition parameter's use
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jan 28, 2006 10:51 pm    Post subject:
Reply with quote

Ravi,

Please start another thread w/that as the topic. The topic of this thread is "File handling in JCL".

You should do this to help others using the search feature when they also have a problem involving the COND param.
Back to top
View user's profile Send private message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Mon Jan 30, 2006 10:39 am    Post subject:
Reply with quote

Hi,
As per Chandan's suggestion I did same changes in my JCL stmt but it is giving same error as "139 Record Length or key data inconsistency " .

Regards,
Nutan
Back to top
View user's profile Send private message
elonics

New User


Joined: 05 Jul 2005
Posts: 49
Location: India

PostPosted: Mon Jan 30, 2006 11:39 am    Post subject: Re: File Handling in JCL
Reply with quote

Hai Nutan,

First mistake you have done is DD names mentioned in JCL are worng. Hope you have corrected that with Chandhan's suggestion.

Second might be, in program you have declared both files as 80 byte length. I want you to check whether the JCL files(IN1.DAT and OUT1.DAT) are having the same 80 byte length.

If it is with different length, craete new files with 80 byte long. this will remove 139 error
.



Thanks,
Uday.
Back to top
View user's profile Send private message
nutan

New User


Joined: 27 Jan 2006
Posts: 26

PostPosted: Mon Jan 30, 2006 1:07 pm    Post subject:
Reply with quote

Hi,
My problem of file is solved . The problem was with file size. I have corrected file size and now able to copy from one file to other .
thanks for your support .
Regards,
nutan
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Mon Jan 30, 2006 3:18 pm    Post subject: Re: File Handling in JCL
Reply with quote

Hi all,
Uday's suggestion is correct,
I think Nutan is using files having record length other than 80,
If you are using files having record length other than 80 u have to give that file structure in FD entry,
otherwise create another files with record length 80 and use them

regards,

chandan
Back to top
View user's profile Send private message
Gops

New User


Joined: 21 Jul 2005
Posts: 23

PostPosted: Tue Jan 31, 2006 12:30 pm    Post subject: Re: File Handling in JCL
Reply with quote

Hey Nutan,

I think I follow the step written by Uday you will get rid of all errors.

Cheers,
Gops
Back to top
View user's profile Send private message
Mane Sagar

New User


Joined: 12 Jul 2005
Posts: 41
Location: mumbai

PostPosted: Tue Jan 31, 2006 3:47 pm    Post subject:
Reply with quote

Hi Nutan,

Just check if the record length of your input file and declare the record length of INFILE in your program correspondingly.

This should make your program run properly.

Regds,
Sagar
Back to top
View user's profile Send private message
elonics

New User


Joined: 05 Jul 2005
Posts: 49
Location: India

PostPosted: Tue Jan 31, 2006 4:05 pm    Post subject: Re: File Handling in JCL
Reply with quote

I dont know why peolple are expanding this conversation. The one who asked this question, had already told that he made necessary corrections and his program is working fine

One request
Quote:

" LET US ALL MAKE USE OF THIS SITE TO THE BEST. DONT MAKE ANY JUNK FALL IN THIS"




Thanks,
Uday

---------------------------------------------------
'I may the best or atleast better than many but never worst'
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us