Expert Answer Center > Experts On Demand > View Answer
EMAIL THIS
Experts on Demand
  EXPERTS ON DEMAND HOME     POSE A QUESTION     VIEW ANSWERS     BROWSE BY TOPIC        RSS FEEDS  
I studied COBOL decades ago and have not programmed since then. However, I have some basic tasks that I'm sure would be feasible with some simple programming.

Are there canned or user-friendly interactive programs for rudimentary tasks? Are there educational resources for a non-expert who would like to code simple programs without having to allocate "programmer time"? Here are a couple tasks I need to do:

  1. Parsing files into a single file, using keys to locate records in each file. Is there a canned program that does this in a user-friendly format? For example, can I use a key field, process each record in File 1 and parse out fields into a fourth file; use a key field in File 1 to look up a record in File 2 and parse out fields from there and so on, with the resulting fourth file being queried using the keys from file 1? All pertinent fields in all three files will be formatted in records viewable on one screen.

  2. Compare two files and create a third file where all duplicates are entered once, while indicating they are duplicate.
QUESTION POSED ON: 24 MAR 2005
QUESTION ANSWERED BY: Tom Ross Every company has subroutines that they share among their users, so that would be the first place to look for samples or canned programs. Those would have the highest likelihood of working with the files you want to work with, because someone else is probably working with them already! After that you could do Web searches and find all kinds of things, though in software, no code ever matches your requirements exactly, which is why we have so many programmers.

I just did a Google search on "sample COBOL programs" and got 95,800 hits. It might be faster to write the code yourself then to search for an existing program!

Now for your specific examples:

  1. Are these VSAM files? Sequential, random or dynamic access? Indexed or relative organization? What is the record length and layout? Which fields from the input files do you want, and in what layout is the output file? What you are asking about is fairly simple to do yourself, but you need to know all the parameters before you start. Would you find a program written somewhere that could be used without changes? The chances are better that you would win the lottery, I think.

  2. That one is fairly easy, use the COBOL "MERGE" verb.
    MERGE file4 ASCENDING KEY key-item 
    USING file1 file2 
    OUTPUT PROCEDURE build-file4. 
    
    build-file-4.
    IF key-item NOT = last-key THEN 
    RETURN current-record 
    END-IF
    Move key-item to last-key.
    
HomeExperts on DemandIT Expert Webcast SeriesExpert KnowledgebaseSite Index
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts