Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Unanswered: Using COBOL to programmatically dump all data

    I have a COBOL that basically gets all columns, all rows from a table. I need to use a program to basically do some massaging of the data prior to writing out to a sequential file.

    Here are my questions:
    1.) I am using ROWSET to get 500 records by FETCH. I have yet to find a good formula for this number other than trial and error. 500 seems to be the sweet spot, at least for this table. Does a formula exist?
    2.) I don't have an ORDER BY because I don't care what order they come out in. Anything else that should be specified on the OPEN such as OPTIMIZE to improve it's performance?
    3.) I am using FOR FETCH ONLY, anything else? I believe FOR READ ONLY and FOR FETCH ONLY are basically the same thing.
    4.) Does DB2 Z/OS V.10 have a TRIM function? I need to remove leading zeros from integers etc. and trailing spaces from alphanumerics.

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    1) I do not know. Too many 'it depends' factors I'm afraid.
    2) No. You already select all cols and no WHERE-clause. That is enough info for DB2
    3) To lock or not to lock. That's the question right? Just use "with UR"
    4) Yes. You can remove leading zero's and trailing spaces using standard functions. Google for 'db2 cookbook' and you will find enough examples.
    Somewhere between " too small" and " too large" lies the size that is just right.
    - Scott Hayes

  3. #3
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    why not use DSNTIAUL? you just massage your data in your select statement, then you have no need to write code/ maintain code/fix your own errors/etc...

    select rtrim(a.col1), strip(a.col3,l,' ') .....
    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •