INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Cobol help for a complete beginner

Cobol help for a complete beginner

(OP)

Hello, I am a complete beginner to Cobol and I am looking for some help.

I am a CS graduate at my first job and my IT company has decided that I now need to learn Cobol. They have pretty much told me to go teach myself and I have come to expect little in the way of assistance. What I am hoping someone here could do would be to direct me to some good resources/tutorials for someone who has object oriented programming and is now needing to learn how to do mainframe related tasks with Cobol and JCL.

I already tried the tutorials on http://www.mainframestechhelp.com/ but I found their grammar atrocious and afterward felt I learned little. I have been looking at completed programs but often feel that they make no sense with my oop background.

An example snippet (Which I found while googling examples link) of my confusion is:

READ STUDENT-FILE
AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
END-READ.
PERFORM PROCESS-RECORDS
UNTIL DATA-REMAINS-SWITCH = 'NO'.


With my background, I read that the second part would never occur because the until condition is already fulfilled. Obviously I am missing something.

Thank you for your time.

RE: Cobol help for a complete beginner

AT END is the EOF condition with the COBOL READ command. With COBOL you have to indicate what you want done when it happens. In this case, "NO" is moved to DATA-REMAINS-SWITCH. Since DATA-REMAINS-SWITCH is initialized to " " (or SPACES), the only condition that will cause the PERFORM to not work is if there is no data to read in STUDENT-FILE. This is what you want.

As for instructional texts, this is the best thing out there bar none. If you have OOP down, procedural coding (what COBOL is) won't be a problem for you. Just think of each program as one long method. More likely though, COBOL is a bit weird in some respects (all languages are), so you'll just have to get through the learning curve aspect of it.

RE: Cobol help for a complete beginner

The 1. part

CODE

READ STUDENT-FILE
  AT END 
    MOVE 'NO' TO DATA-REMAINS-SWITCH
END-READ 
reads only 1.record of the file (when the file has no more record it sets the DATA-REMAINS-SWITCH = 'NO')

Then the 2. part is a loop, which reads the rest of the file

CODE

PERFORM 
  PROCESS-RECORDS
UNTIL DATA-REMAINS-SWITCH = 'NO'. 

Look into the paragraf PROCESS-RECORDS - after processing of the record (i.e. printing) it contains the same as in the 1.part (i.e. reading next record):

CODE

...
READ STUDENT-FILE
  AT END 
    MOVE 'NO' TO DATA-REMAINS-SWITCH
END-READ. 

When the PROCESS-RECORD should not contain reading of the next record,
then you could try something like this

CODE

MOVE 'YES' TO DATA-REMAINS-SWITCH
PERFORM UNTIL DATA-REMAINS-SWITCH = 'NO'
  READ FILE
    AT END
      MOVE 'NO' TO DATA-REMAINS-SWITCH
    NOT AT END
      PERFORM PROCESS-RECORD
  END-READ
END-PERFORM 

RE: Cobol help for a complete beginner

There are several mainframe forums out there that will help you along. The IBM manuals that you will need are available online and usually linked to from those forums.


Nic

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close