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
 

 

How to use input file in cobol with 2 diffrent layout

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
trumpcards
Warnings : 1

New User


Joined: 03 Jul 2006
Posts: 11

PostPosted: Fri Apr 18, 2008 12:56 pm    Post subject: How to use input file in cobol with 2 diffrent layout
Reply with quote

There are 2 different JCLs which uses the same COBOL program. But The input file length is different in two jcls. How can we define and use in the COBOL program.

EX:

JCL1 has input file of 650 length and JCL2 has 750 length. Output file lenths are same. These 2 jCls have to call the same program. How can we define and use in the COBOL program.
Back to top
View user's profile Send private message

vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Fri Apr 18, 2008 2:57 pm    Post subject:
Reply with quote

Hi,


This can be handled using PARM of JCl

you have to define SELECT statement for both of th file means for input files having length 650 and 750,

so when you are executing program with input file length 650 code as below.

JCL1

Code:
// JOB CARD
//STEP1 EXEC PGM = COBOLPGM, PARM = '1'
//INFILE1  DD  DSN = DATA.SET.NAME(650 LENGTH), DISP=SHR
//OUPUT    DD  DSN = OUT.PUT.DATA(SAME LENGTH), DISP=SHR
//SYSIN    DD  DUMMY
//SYSOUT   DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*


You can handle the PARM value in cobol program if PARM value is 1, open the dataset having length 650 and process write the output file.

If ur executing a program with input file having length 750

JCL2

Code:

// JOB CARD
//STEP1 EXEC PGM = COBOLPGM, PARM = '2'
//INFILE1  DD  DSN = DATA.SET.NAME(650 LENGTH), DISP=SHR
//OUPUT    DD  DSN = OUT.PUT.DATA(SAME LENGTH), DISP=SHR
//SYSIN    DD  DUMMY
//SYSOUT   DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*


You can handle the PARM value in cobol program if PARM value is 2, open the dataset having length 750 and process and write the output file.


You can change the PARM value acording to your desire........ icon_biggrin.gif
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 Apr 18, 2008 3:05 pm    Post subject: Reply to: How to use input file in cobol with 2 diffrent lay
Reply with quote

Why can't you pre-process the input files and make them both the same length BEFORE calling the program?
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Fri Apr 18, 2008 3:27 pm    Post subject:
Reply with quote

Hi Superk,

I also took the assignment of same scenario, so i hamdled like this and also requirement was also like this only, so i didnot get any chance to preprocess the file.

if you have any idea please suggest us.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Fri Apr 18, 2008 3:37 pm    Post subject:
Reply with quote

Hi Superk,

Quote:
Why can't you pre-process the input files and make them both the same length BEFORE calling the program


Could you please tell me how can i do approach for this?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 18, 2008 7:53 pm    Post subject:
Reply with quote

Hello,

Quote:
Could you please tell me how can i do approach for this?
Sort, IEBGENER, etc.

Just copy the file to another with the common dcb info.

If the data actully has different lengths, will there not be some inconsistencies in the "common" cobol program? What will be done to handle the "missing" or "extra" bytes?
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Fri Apr 18, 2008 10:30 pm    Post subject:
Reply with quote

Hello,

dick scherrer wrote:


Quote:
Could you please tell me how can i do approach for this?
Sort, IEBGENER, etc.

Just copy the fine to another with the common dcb info.

If the data actully has different lengths, will there not be some inconsistencies in the "common" cobol program? What will be done to handle the "missing" or "extra" bytes?


Is that good coding practice more over he given requirement cleary that there are 2 JCL which uses common COBOL program but 2 JCL(Which could be RUN at different interval)

Is I am correct Dick,
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 18, 2008 11:09 pm    Post subject:
Reply with quote

Hello Raghu,

It is rather common to have a program that is executed in multiple jobs (often even more than 2). What is not so common is to have the same program process the "same" file with different lrecls. The original question needs clarification. . .

Usually if lrecls are different, that means the files are different and would usually be dealt with in different code. Even if the "short" file were copied to a file with the longer lrecl, the last 100 bytes would be useless.

If we had better information we could make better suggestions.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Apr 18, 2008 11:20 pm    Post subject:
Reply with quote

Interestingly, that (almost) same subject was just resolved lately with the non obvious title of Program abends with SOC4 while reading the 231st record
Back to top
View user's profile Send private message
jasorn

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Fri May 16, 2008 10:43 am    Post subject:
Reply with quote

You can also use one fd by coding record contains 0.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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