How To create a program That accept file of different Record Length &create a file with the same record length as the input one

This is a discussion on How To create a program That accept file of different Record Length &create a file with the same record length as the input one within the cobol forums in Programming Languages category; Hi guys, I have a technical question. I want to create a cobol program which accept a File (FB, of any record length [from 1 to 2000) and create a output file with the same format as the input one All the record in the file have the same length, so i don't want to deal with VB file. I just want to know if somebody know how i'm suppose to declare the FD statement. And in the JCL how i'm suppose to the declare the input and output file. Thanks for your help guys...

Go Back   Application Development Forum > Programming Languages > cobol

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-26-2008, 03:43 AM
tiyinyin
Guest
 
Default How To create a program That accept file of different Record Length &create a file with the same record length as the input one

Hi guys,
I have a technical question.

I want to create a cobol program which accept a File (FB, of any
record length [from 1 to 2000) and create a output file with the same
format as the input one

All the record in the file have the same length, so i don't want to
deal with VB file.

I just want to know if somebody know how i'm suppose to declare the FD
statement.
And in the JCL how i'm suppose to the declare the input and output
file.

Thanks for your help guys
Reply With Quote
  #2  
Old 07-26-2008, 06:56 AM
William M. Klein
Guest
 
Default Re: How To create a program That accept file of different Record Length & create a file with the same record length as the input one

From the uses of the terms "FB" and "VB" my guess is that this is an IBM
mainframe question. If not, tell us your compiler and operating system.

Assuming IBM mainframe, the simple answer is:

This CANNOT be done in IBM Enterprise COBOL.

You will get a FS=39 if you don't have the LRECL of the physical file MATCH the
record size of the single FD at compile time.

There are "ways around this" (sort-of) but most of them are "tricks" or
semi-supported OR require use of Assembler subroutines. It really sounds like
you are asking for something that can (semi-)easily be done via DFSort or
SyncSort.

If you are looking for "tricks":

1) Consider passing the FD name (not the record name under the FD) to a
subprogram (COBOL or Assembler). This will allow the subprogram to "play" with
the DCB. (This does NOT work for VSAM files). If you "understand" DCB
structures, you may be able to get this to work.

2) There is/was a trick with calling a RECFM=FB file RECFM=U that did (and in
some cases still does) work. However, this is pretty unreliable. If this is of
interest, you should read the information at:
http://publibfp.boulder.ibm.com/cgi-...igy3mg40/3.5.3

* * *

If this is a "critical" issue for your site, you may want to ask your IBM
marketing rep (if any) to submit a "REQUEST" to IBM and reference the existing
requirement:

MR1202046545
or
SSLNGC0413613

which reads,
"Dynamic file attribute options (ident-1 rather int-1 in FD)"



--
Bill Klein
wmklein <at> ix.netcom.com
"tiyinyin" <progsystem@gmail.com> wrote in message
news:bf1fe48d-8d54-4832-8fc7-3a34914c7f00@x41g2000hsb.googlegroups.com...
> Hi guys,
> I have a technical question.
>
> I want to create a cobol program which accept a File (FB, of any
> record length [from 1 to 2000) and create a output file with the same
> format as the input one
>
> All the record in the file have the same length, so i don't want to
> deal with VB file.
>
> I just want to know if somebody know how i'm suppose to declare the FD
> statement.
> And in the JCL how i'm suppose to the declare the input and output
> file.
>
> Thanks for your help guys



Reply With Quote
  #3  
Old 07-26-2008, 12:36 PM
Clark F Morris
Guest
 
Default Re: How To create a program That accept file of different Record Length & create a file with the same record length as the input one

On Sat, 26 Jul 2008 10:56:39 GMT, "William M. Klein"
<wmklein@nospam.netcom.com> wrote:

>From the uses of the terms "FB" and "VB" my guess is that this is an IBM
>mainframe question. If not, tell us your compiler and operating system.
>
>Assuming IBM mainframe, the simple answer is:
>
> This CANNOT be done in IBM Enterprise COBOL.
>
>You will get a FS=39 if you don't have the LRECL of the physical file MATCH the
>record size of the single FD at compile time.


What is really enraging is that the LRECL of a VB record must match
the LRECL of the file being read. The bypass is to code the expected
record length on the DD card overriding the DSCB or tape label of the
file. This works so long as the LRECL of the file is less than the
LRECL in the COBOL program (note LRECL is COBOL record length + 4).
RECORD 0 used to work but I guess they got rid of that.
>
>There are "ways around this" (sort-of) but most of them are "tricks" or
>semi-supported OR require use of Assembler subroutines. It really sounds like
>you are asking for something that can (semi-)easily be done via DFSort or
>SyncSort.
>
>If you are looking for "tricks":
>
>1) Consider passing the FD name (not the record name under the FD) to a
>subprogram (COBOL or Assembler). This will allow the subprogram to "play" with
>the DCB. (This does NOT work for VSAM files). If you "understand" DCB
>structures, you may be able to get this to work.
>
>2) There is/was a trick with calling a RECFM=FB file RECFM=U that did (and in
>some cases still does) work. However, this is pretty unreliable. If this is of
>interest, you should read the information at:
> http://publibfp.boulder.ibm.com/cgi-...igy3mg40/3.5.3
>
>* * *
>
>If this is a "critical" issue for your site, you may want to ask your IBM
>marketing rep (if any) to submit a "REQUEST" to IBM and reference the existing
>requirement:
>
>MR1202046545
> or
>SSLNGC0413613
>
>which reads,
> "Dynamic file attribute options (ident-1 rather int-1 in FD)"

Reply With Quote
  #4  
Old 07-27-2008, 08:17 AM
zalek
Guest
 
Default Re: How To create a program That accept file of different RecordLength & create a file with the same record length as the input one

On Jul 26, 3:43*am, tiyinyin <progsys...@gmail.com> wrote:
> Hi guys,
> I have a technical question.
>
> I want to create a cobol program which accept a File (FB, of any
> record length [from 1 to 2000) and create a output file with the same
> format as the input one
>
> All the record in the file have the same length, so i don't want to
> deal with VB file.
>
> I just want to know if somebody know how i'm suppose to declare the FD
> statement.
> And in the JCL how i'm suppose to the declare the input and output
> file.
>
> Thanks for your help guys


I don't think you can do this in Cobol - Cobol FD requires definition
of record size.
You can use a sort utility - it allows some record selection/
modification and do not require record size definition. In SORTOUT you
will have:
//SORTOUT DD DSN=....
// DCB=*.SORTIN

Zalek
Reply With Quote
  #5  
Old 07-28-2008, 10:34 AM
Howard Brazee
Guest
 
Default Re: How To create a program That accept file of different Record Length & create a file with the same record length as the input one

On Sat, 26 Jul 2008 00:43:31 -0700 (PDT), tiyinyin
<progsystem@gmail.com> wrote:

>Hi guys,
>I have a technical question.
>
>I want to create a cobol program which accept a File (FB, of any
>record length [from 1 to 2000) and create a output file with the same
>format as the input one
>
>All the record in the file have the same length, so i don't want to
>deal with VB file.
>
>I just want to know if somebody know how i'm suppose to declare the FD
>statement.
>And in the JCL how i'm suppose to the declare the input and output
>file.
>
>Thanks for your help guys


Why are you using CoBOL here, instead of, say a Sort utility?
Reply With Quote
  #6  
Old 07-28-2008, 01:13 PM
William M. Klein
Guest
 
Default Re: How To create a program That accept file of different Record Length & create a file with the same record length as the input one

There is a "COBOL-only" solution that I didn't mention in my original post. If
you use ISPF "library services" to read each of the files (and don't use COBOL
FD, OPEN, READ, etc), this will allow you to (on MVS) access a "random" number
of files of "random" file attributes.

See:
http://publibz.boulder.ibm.com/cgi-b...ispzsg61/1.5.3

and
http://publibz.boulder.ibm.com/cgi-b.../ispzsg61/2.32


--
Bill Klein
wmklein <at> ix.netcom.com
"Howard Brazee" <howard@brazee.net> wrote in message
news:a7mr84t8c031pc5rnftv01uj3u3a6lg9g0@4ax.com...
> On Sat, 26 Jul 2008 00:43:31 -0700 (PDT), tiyinyin
> <progsystem@gmail.com> wrote:
>
>>Hi guys,
>>I have a technical question.
>>
>>I want to create a cobol program which accept a File (FB, of any
>>record length [from 1 to 2000) and create a output file with the same
>>format as the input one
>>
>>All the record in the file have the same length, so i don't want to
>>deal with VB file.
>>
>>I just want to know if somebody know how i'm suppose to declare the FD
>>statement.
>>And in the JCL how i'm suppose to the declare the input and output
>>file.
>>
>>Thanks for your help guys

>
> Why are you using CoBOL here, instead of, say a Sort utility?



Reply With Quote
  #7  
Old 08-04-2008, 03:28 PM
tiyinyin
Guest
 
Default Re: How To create a program That accept file of different RecordLength & create a file with the same record length as the input one

Thanks you very much for the lot of information that you provide. They
really seem so accurate. I can guess that you have a very good
experience with working on the mainframe.
Thank you for all.
I will try all these solution soon and will not hesitate to give you
feedbacks.


ps:Sorry for my poor english i'm trying my best.

On 28 juil, 19:13, "William M. Klein" <wmkl...@nospam.netcom.com>
wrote:
> There is a "COBOL-only" solution that I didn't mention in my original post. *If
> you use ISPF "library services" to read each of the files (and don't use COBOL
> FD, OPEN, READ, etc), this will allow you to (on MVS) access a "random" number
> of files of "random" file attributes.
>
> See:
> *http://publibz.boulder.ibm.com/cgi-b...OKS/ispzsg61/1....
>
> and
> *http://publibz.boulder.ibm.com/cgi-b.../ispzsg61/2.32
>
> --
> Bill Klein
> *wmklein <at> ix.netcom.com"Howard Brazee" <how...@brazee.net> wrote inmessage
>
> news:a7mr84t8c031pc5rnftv01uj3u3a6lg9g0@4ax.com...
>
>
>
> > On Sat, 26 Jul 2008 00:43:31 -0700 (PDT), tiyinyin
> > <progsys...@gmail.com> wrote:

>
> >>Hi guys,
> >>I have a technical question.

>
> >>I want to create a cobol program which accept a File (FB, of any
> >>record length [from 1 to 2000) and create a output file with the same
> >>format as the input one

>
> >>All the record in the file have the same length, so i don't want to
> >>deal with VB file.

>
> >>I just want to know if somebody know how i'm suppose to declare the FD
> >>statement.
> >>And in the JCL how i'm suppose to the declare the input and output
> >>file.

>
> >>Thanks for your help guys

>
> > Why are you using CoBOL here, instead of, say a Sort utility?


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:19 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.