View previous topic :: View next topic
|
Author |
Message |
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
COBOL program consisting of files. How to execute that program through JCL ? |
|
Back to top |
|
|
vikasc4
New User
Joined: 11 Dec 2005 Posts: 32
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
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 |
|
|
vikasc4
New User
Joined: 11 Dec 2005 Posts: 32
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
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 |
|
|
vikasc4
New User
Joined: 11 Dec 2005 Posts: 32
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
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 |
|
|
vikasc4
New User
Joined: 11 Dec 2005 Posts: 32
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
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 |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
The program compiles fine. If you make the JCL changes as suggested by chandan, then the program runs just fine also. |
|
Back to top |
|
|
ravi narayan padhi
New User
Joined: 26 Jan 2006 Posts: 1 Location: delhi
|
|
|
|
im totally confused about the condition parameter's use |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
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 |
|
|
elonics
New User
Joined: 05 Jul 2005 Posts: 49 Location: India
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
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 |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
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 |
|
|
Gops
New User
Joined: 21 Jul 2005 Posts: 23
|
|
|
|
Hey Nutan,
I think I follow the step written by Uday you will get rid of all errors.
Cheers,
Gops |
|
Back to top |
|
|
Mane Sagar
New User
Joined: 12 Jul 2005 Posts: 41 Location: mumbai
|
|
|
|
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 |
|
|
elonics
New User
Joined: 05 Jul 2005 Posts: 49 Location: India
|
|
|
|
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 |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
Hi,
Even I want to say same stmt as Uday said coz my problem is solved and I have already told you . Thanks for your support .
Regards,
Nutan |
|
Back to top |
|
|
|