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
 

 

reading variable length fixed block files

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

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Tue Mar 22, 2011 12:46 pm    Post subject: reading variable length fixed block files
Reply with quote

I have GDG files as input to my program.
all GDG files are FB, but the record length are different for each one.
That depends on the table from which unload has been taken into GDG.
Now I need to read the GDG's and count number of records in them and write into an output file.
But if I declare FD as

Code:


FD  INPUT-CARD                         
    RECORDING MODE IS F               
    RECORD CONTAINS 0 CHARACTERS       
    LABEL RECORDS ARE OMITTED.

01  INPUT-CARD-REC                 PIC X(1000).     



to handle the above problem, max length the files could have is 1000, it says file length mismatch between the assigned file and INPUT-CARD.
Sometimes it fail with SOC4.
If I skip the PIC X(1000) part it fails at compilation.

Can anyone tell me what change i need to do in the program to handle different Fixed Block input files.

Thanks in advance!
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 22, 2011 1:54 pm    Post subject:
Reply with quote

Why write a program when various utilities already exist
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Mar 22, 2011 1:57 pm    Post subject:
Reply with quote

1. If you are using absolute-generation in the JCL and that has different LRECL than 1000 - typically LE U4038 is invitable.

2. Are you reading the entire GDG Base? If so, RECORDING MODE should be V:
Code:
RECORDING MODE IS V

Actually, if you are dealing with VB file, declaration in FD should be like:
Code:
RECORDING MODE IS V                                 
RECORD IS VARYING IN SIZE FROM 1 TO 1000   CHARACTERS
where 1000 is maximum length a record can have in that VB file.

But then how would you count the records in individual GDS, is there some way to identify the data from next generation is started!?
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Tue Mar 22, 2011 4:41 pm    Post subject:
Reply with quote

Hi Anuj,

Thanks for the help, I tried the code, but that is giving below error

Code:


A file attribute mismatch was detected. File INPUT-CARD in program DISPARM1 was
and the file specified in the ASSIGN clause did not contain the same attribute.
A file attribute mismatch was detected. File INPUT-CARD in program DISPARM1 had
the file specified in the ASSIGN clause had a record length of 136.             
There was an unsuccessful OPEN or CLOSE of file IN1 in program DISPARM1 at relat
Neither FILE STATUS nor an ERROR declarative were specified. The status code was
From compile unit DISPARM1 at entry point DISPARM1 at compile unit offset +00000
 at address 25A00BCA.                                                           
ENTERED (LEVEL 04/01/2008 AT 12.32)                                             
PROCESSING COMPLETE. RC=0                                                       



File INPUT-CARD in program DISPARM1 was defined as RECORDING MODE V ASSIGN clause did not contain the same attribute.

Here I am giving example of my GDG's. They are FB basically..thats why if V mode its given its not accepting.

Code:

 General Data                           Current Allocation                   
  Management class . . : DHF             Allocated cylinders : 1             
  Storage class  . . . : DH              Allocated extents . : 1             
   Volume serial . . . : DHV278                                               
   Device type . . . . : 3390                                                 
  Data class . . . . . : NULLDC                                               
   Organization  . . . : PS             Current Utilization                   
   Record format . . . : FB              Used cylinders  . . : 0             
   Record length . . . : 776             Used extents  . . . : 0             
   Block size  . . . . : 27936                                               
   1st extent cylinders: 1                                                   
   Secondary cylinders : 10             Dates                                 
   Data set name type  :                 Creation date . . . : 2011/02/06     
   SMS Compressible. . : NO              Referenced date . . : 2011/03/21     
                                         Expiration date . . : ***None***     


for another

Code:

 General Data                           Current Allocation                     
  Management class . . : DHF             Allocated cylinders : 1               
  Storage class  . . . : DH              Allocated extents . : 1               
   Volume serial . . . : DHV420                                               
   Device type . . . . : 3390                                                 
  Data class . . . . . : NULLDC                                               
   Organization  . . . : PS             Current Utilization                   
   Record format . . . : FB              Used cylinders  . . : 0               
   Record length . . . : 240             Used extents  . . . : 0               
   Block size  . . . . : 27840                                                 
   1st extent cylinders: 1                                                     
   Secondary cylinders : 10             Dates                                 
   Data set name type  :                 Creation date . . . : 2011/03/16     
   SMS Compressible. . : NO              Referenced date . . : 2011/03/21     


I have a proc and i am passing the DSN information in that to achieve this.
Let me know if you need more information.


Expat,

I am not aware of such utilities, please let me the name so i can learn more on that icon_smile.gif

Thanks to both of you...
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Mar 22, 2011 5:07 pm    Post subject: Reply to: reading variable length fixed block files
Reply with quote

Click below and follow the subsequent links -

http://ibmmainframes.com/viewtopic.php?p=263394&highlight=#263394

Bill
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 22, 2011 5:53 pm    Post subject:
Reply with quote

Products like SORT, IEBGENER will read any file and also give you a count of the records in the file.

Probably more SORT if you want to write the count into a file. Search the DFSORT / JCL forums for examples.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Tue Mar 22, 2011 5:59 pm    Post subject:
Reply with quote

Thanks Bill for the help again icon_smile.gif
You guys are always a great help!

I have checked the subsequent links,but they mainly talks about RECFM=VB files, my GDG's are all FB.

I tried defining the FD as,
Code:


 FD  INPUT-CARD                                             
     RECORDING MODE IS V                                   
     RECORD IS VARYING IN SIZE FROM 1 TO 1000 CHARACTERS   
     DEPENDING ON WS-DR-LEN                                 
     BLOCK CONTAINS 0 RECORDS.                             
 01  INPUT-CARD-REC                 PIC X(1000).           



But that gives file attribute mismatch. As the FD definition says its Variable but actual GDG's are all FB.
So here I need to use recording mode V.
I tried recording mode U as well. But that is not helping in this case.
please provide your valuable suggestion.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Tue Mar 22, 2011 6:02 pm    Post subject:
Reply with quote

Hello Expat,

Actually along with the count I need to print the database name as well.
Thanks for the suggestion.
I will try printing table name with the program and for count will use utility.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 22, 2011 6:05 pm    Post subject:
Reply with quote

And would probably be even more help if YOU would actually state the full requirement in the first place rather than just throwing in additional bits of information halfway along the topic.

Where is the table name stored, on the input file, if so, then search the forum again for more help in extracting data from the file and printing / writing it to another dataset.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Tue Mar 22, 2011 6:36 pm    Post subject:
Reply with quote

Sorry for not providing the full information before hand.I thought of not to confuse people with all requirements together.Let me write it clearly,
1. I need to run daily backup jobs to take backup of DB2 tables.
2. Along with the backup i need to generate a report file in which I am writing the database/table name along with the number of records,which will help in future tracking if data got added/deleted.

for this I have written a PROC

Code:


//MY       PROC DB=,N=,T= 


In which

IKJEFT1A is being used to create GDG and take backups in the flat file.
Backup system is working fine.
Now I have added a new step with my cobol program to count the number of records and display DB=,T=
information in the report file, these 3 things are being passed in PARM field to the program and in turn program writes it in the output file.
Also input file records being counted and printed.

Table names are not stored in any input file

//S05 EXEC MY,DB=DAT,N=ABC,T='MYNAME'

proc is executed to pass these info's

And all the GDG's are FB.
I am using the PROCs for all of them.So the requirement is to count records and display table name in the report file for different FB input files.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1717
Location: UK

PostPosted: Tue Mar 22, 2011 6:52 pm    Post subject:
Reply with quote

If your records are FB, which your dataset characteristics say they are, why are you mentioning variable records?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Mar 22, 2011 6:56 pm    Post subject:
Reply with quote

one of the reasons that you are not getting any 'nice' answers
is that we all know that you are a rookie, who does not want to listen,
and worse: does not want to change his little bs process.

IKJEFT1A invokes programs they can be
  • utilities from ibm
  • 3rd party utilties
  • user written programs


so, we don't have any idea what you are doing,
except wasting our time trying to impress us with your lack of knowledge.

somewhere, someplace, something knows the
  • name of the table
  • name of the gdg
  • the gdg attributes
.
with that information, it would not be difficult at all to compile a report,
unless you worked yourself into a corner,
due to lack of experience,
and have a non-communicative process.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Tue Mar 22, 2011 6:59 pm    Post subject:
Reply with quote

Let me confirm what you want: COBOL supports two types of files: fixed length record files, and variable length record files. You have different files you want to process using the same DD statement, and they are each, individually, fixed length records but they each have different length records. If this is indeed what you are trying to do -- give up. I am not sure it can be done in COBOL at all, and if it could be done it would take a very advanced practitioner some time (weeks, maybe longer) to work out how to do it.

Handle each file with a different record length separately -- the COBOL code becomes much simpler. If this cannot be done for whatever reason, you will have to go back to whoever gave you the assignment and tell them it cannot be done in COBOL (and probably not using utilities either).
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Mar 22, 2011 7:11 pm    Post subject:
Reply with quote

If you are using any of the most common utilities to unload the tables (create backups), then that utility's output report should contain both the name of the table being unloaded and a count of the number of rows unloaded. Often, it will also contain the DSN of the unload dataset. It should be a simple matter to "scrape" each of those reports to obtain the information you seek.
Why re-invent the wheel?
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Wed Mar 23, 2011 12:22 pm    Post subject:
Reply with quote

Thanks Robert for the help!

I am trying to pass the database/Table name with the program and COUNT with SORT facility.

But as the input FB's are all different in LRECL.
I am getting below error
Code:

SYSIN :                                                                       
  SORT FIELDS=COPY                                                      0000010
  OUTFIL REMOVECC,NODETAIL,                                             0000020
   TRAILER1=('COUNT: ',COUNT=(M11,LENGTH=8))                            0000030
WER276B  SYSDIAG= 16343, 1684373, 1684373, 12450825                           
WER164B  6,852K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
WER164B     64K BYTES RESERVE REQUESTED, 960K BYTES USED                       
WER146B  64K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  SORTIN   : RECFM=FB   ; LRECL=    32; BLKSIZE= 27968                 
WER110I  SORTOUT  : RECFM=FB   ; LRECL=   130; BLKSIZE= 27950                 
WER247A  SORTOUT  HAS INCOMPATIBLE LRECL                                       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 


For some...
and for some its working fine

Code:


 SORTIN   : RECFM=FB   ; LRECL=   152; BLKSIZE= 27968                 
 SORTOUT  : RECFM=FB   ; LRECL=   130; BLKSIZE= 27950                 
 5,824K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,     
    0 BYTES RESERVE REQUESTED, 103,272 BYTES USED                     
 SORTOUT  :  DATA RECORDS OUT          0; TOTAL RECORDS OUT          1
 SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
 SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
 SORTIN   : EXCP'S=1,UNIT=3390,DEV=18D5,CHP=(B1B5BDC1C5C9CD,1),VOL=DHV
 OUTFIL WAS USED FOR SORTOUT                                         
 RCD IN         40, OUT         40                                   




Can anyone please tell me how to overcome

SORTOUT HAS INCOMPATIBLE LRECL


Shall I give any particular LRECL while defining the report file?

Successful output shows as below,

Code:

DATABASE: DATABASE1       TABLE: TABLE1...............
COUNT: 00000040                                             



Robert, can you please explain how can I handle each file seperately?

Dick,

All answers were really 'nice' to me icon_smile.gif
Thank you for taking time and reading it...
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Mar 23, 2011 8:41 pm    Post subject:
Reply with quote

Will coding NULLFILE for your SORTOUT DD not remove your need for specifying DCB information in you JCL, and thus remove the incompatible LRECL error.

As for as I understand the sorted output file is not used for anything, only the SORT report output.
Back to top
View user's profile Send private message
chatterjesis

New User


Joined: 31 Aug 2008
Posts: 31
Location: hyderabad

PostPosted: Wed Mar 23, 2011 10:26 pm    Post subject:
Reply with quote

Thanks to all icon_smile.gif

the problem has been resolved.

Thanks Kjeld I have followed your suggestion and it worked.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Mar 23, 2011 10:30 pm    Post subject:
Reply with quote

Did you read the post from Ronold Burr?

The information you need is probably already available.

You probably do not need a seperate program to count after the fact.

Post the JCL for the step that performs the backup (I know it is working fine), but post it anyway.

Post the output from this step (the one that shows the table information and counts).

If you provide this information, additional help can be provided.
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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