Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please HELP!!!!

Status
Not open for further replies.

hhouse

Technical User
Feb 12, 2001
2
0
0
US
I need to have a COBOL program done by 17Feb01 for school and dont no where to start? here are the requirments:



The Human Resources manager has requested that we write a program to create mailing labels for employees. These mailing labels will enable him to send out benefit information.

The input file will be provided by the H.R. department and will consist of the following:

Name 1-30
Sex 36
Marital status 37
Street address 40-55
City 56-70
State 71-72
Zip code 73-77

The labels we are to create are on a " THREE UP " continuous form. The layout of the output is in a separate file.

We are to print 6 sets of labels on a "page". The top of each page will have the report number of "REPORT NO. 04", the date (in the format of (MMM DD,CCYY), and the page number.

Can anyone help?


 
hhouse,

as a programmer, i would give back this assignment; four days is crazy ... as a student, i would ask a some questions:

- what does the label page layout look like (i.e. spacing, no. of characters in height & width) ? If i read your info correctly, a page contains two labels across and 6 down, totalling 12 (If not, adjust to following accordingly).

Once you've figured this out, process your input records two at a time to form the output records (= lines) for two labels next to eachother; process two by two until you have one or none left. If one, process it together with a "dummy" (= empty) record.
Oh, yeah: start each page witdh your header, and skip to a next page after processing 12 input records.
Done !

If this is way, way to concise, let me know.

Good luck !
 
Hi,

your inputrecord will look like this:

01 INPUT-RECORD.
03 IR-NAME PIC X(30).
03 FILLER PIC X(05).
03 IR-SEX PIC X.
03 IR-MR-STAT PIC X.
03 FILLER PIC XX.
03 IR-STREET PIC X(16).
03 IR-CITY PIC X(15).
03 IR-STATE PIC XX.
03 IR-ZIP-CODE PIC X(05).

I don't know the american address layout, but just trying something it looks like:

REPORT NO. 04 DATE @@@ ##,### PAGE ###

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@ @@@@@ @@ @@@@@


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@ @@@@@ @@ @@@@@


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@ @@@@@ @@ @@@@@


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@ @@@@@ @@ @@@@@


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@ @@@@@ @@ @@@@@


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@
@@ @@@@@ @@ @@@@@


and the generated WORKING-STORAGE for that layout will be:

01 SC01-SCHERMNAAM.
02 SC01-01 VALUE
'REPORT NO. 04 DATE @@
- '@ ##,### PAGE ### '.
03 FILLER PIC X(38).
03 SC01-RU001 PIC X(03).
03 FILLER PIC X(01).
03 SC01-RU002 PIC 9(02).
03 FILLER PIC X(01).
03 SC01-RU003 PIC 9(03).
03 FILLER PIC X(20).
03 SC01-RU004 PIC 9(03).
03 FILLER PIC X(09).
02 SC01-02 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-03 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU005 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU006 PIC X(30).
03 FILLER PIC X(09).
02 SC01-04 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU007 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU008 PIC X(16).
03 FILLER PIC X(23).
02 SC01-05 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU009 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU010 PIC X(15).
03 FILLER PIC X(24).
02 SC01-06 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU011 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU012 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU013 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU014 PIC X(05).
03 FILLER PIC X(31).
02 SC01-07 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-08 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-09 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU015 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU016 PIC X(30).
03 FILLER PIC X(09).
02 SC01-10 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU017 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU018 PIC X(16).
03 FILLER PIC X(23).
02 SC01-11 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU019 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU020 PIC X(15).
03 FILLER PIC X(24).
02 SC01-12 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU021 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU022 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU023 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU024 PIC X(05).
03 FILLER PIC X(31).
02 SC01-13 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-14 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-15 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU025 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU026 PIC X(30).
03 FILLER PIC X(09).
02 SC01-16 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU027 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU028 PIC X(16).
03 FILLER PIC X(23).
02 SC01-17 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU029 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU030 PIC X(15).
03 FILLER PIC X(24).
02 SC01-18 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU031 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU032 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU033 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU034 PIC X(05).
03 FILLER PIC X(31).
02 SC01-19 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-20 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-21 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU035 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU036 PIC X(30).
03 FILLER PIC X(09).
02 SC01-22 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU037 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU038 PIC X(16).
03 FILLER PIC X(23).
02 SC01-23 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU039 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU040 PIC X(15).
03 FILLER PIC X(24).
02 SC01-24 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU041 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU042 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU043 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU044 PIC X(05).
03 FILLER PIC X(31).
02 SC01-25 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-26 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-27 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU045 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU046 PIC X(30).
03 FILLER PIC X(09).
02 SC01-28 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU047 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU048 PIC X(16).
03 FILLER PIC X(23).
02 SC01-29 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU049 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU050 PIC X(15).
03 FILLER PIC X(24).
02 SC01-30 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU051 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU052 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU053 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU054 PIC X(05).
03 FILLER PIC X(31).
02 SC01-31 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-32 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-33 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU055 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU056 PIC X(30).
03 FILLER PIC X(09).
02 SC01-34 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU057 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU058 PIC X(16).
03 FILLER PIC X(23).
02 SC01-35 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU059 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU060 PIC X(15).
03 FILLER PIC X(24).
02 SC01-36 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU061 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU062 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU063 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU064 PIC X(05).
03 FILLER PIC X(31).
02 SC01-37 VALUE
'
- ' '.
03 FILLER PIC X(80).


If you are smart, you can define a kind of table for this.

Have fun and I hope this helps! :)

By the way, this took about 10 minutes.
 
continued:

02 SC01-28 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU047 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU048 PIC X(16).
03 FILLER PIC X(23).
02 SC01-29 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU049 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU050 PIC X(15).
03 FILLER PIC X(24).
02 SC01-30 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU051 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU052 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU053 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU054 PIC X(05).
03 FILLER PIC X(31).
02 SC01-31 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-32 VALUE
'
- ' '.
03 FILLER PIC X(80).
02 SC01-33 VALUE
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU055 PIC X(30).
03 FILLER PIC X(09).
03 SC01-RU056 PIC X(30).
03 FILLER PIC X(09).
02 SC01-34 VALUE
' @@@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU057 PIC X(16).
03 FILLER PIC X(23).
03 SC01-RU058 PIC X(16).
03 FILLER PIC X(23).
02 SC01-35 VALUE
' @@@@@@@@@@@@@@@
- ' @@@@@@@@@@@@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU059 PIC X(15).
03 FILLER PIC X(24).
03 SC01-RU060 PIC X(15).
03 FILLER PIC X(24).
02 SC01-36 VALUE
' @@ @@@@@
- ' @@ @@@@@ '.
03 FILLER PIC X(02).
03 SC01-RU061 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU062 PIC X(05).
03 FILLER PIC X(31).
03 SC01-RU063 PIC X(02).
03 FILLER PIC X(01).
03 SC01-RU064 PIC X(05).
03 FILLER PIC X(31).
02 SC01-37 VALUE
'
- ' '.
03 FILLER PIC X(80).


If you are smart, you can define a kind of table for this.

Have fun and I hope this helps!

By the way, this took about 10 minutes.

 
Hi H,

I usually try not to do someone's homework, but I thought this might help you to use an "approach" to coding. I find this missing in most courses and texts on the subject. This is one of my hot button issues. I hope you'll take a look at this and come to the same conclusion I did over the years: a program is a unique device; it not only provides a solution, but acts as its own maintenance manual. And for that reason, care should be taken as to how the solution is presented. I hope this helps. It may even ignite a "religious war". But that can be informative too.

Regards, Jack.

P.S. I'm sure there are erros in the code, but it was intended only to illustrate the approach. Getting the bugs out is your job.:)

Code:
       working-storage section.
           01  ws-switches-etc.
               05  nbr-of-labels        pic  9(001) comp.
                   88  line-is-finished      value 4. 
               05  nbr-of-sets          pic  9(002) comp.
                   88  set-is-finished       value 13.
               05  input-eof-sw         pic  x(001)
                                             value 'n'.
                   88  input-eof             value 'y'.

           01  ws-file-recs.
               05  ws-set-area.
                   10  ws-label-line-1 occurs 3.
                       15  ws-label-fld1  etc.
                   10  ws-label-line-2 occurs 3.
                       15  ws-label-fldx etc.
                   .
                   .
                   .
                   etc. 

       procedure division.
           perf.. 8000-init
           perf.. 7000-1st-read
           perf.. 1000-proc-a-page
              until input-eof 
           perf.. 9000-end-it
           stop run
           .

       1000-proc-a-page.
           perf.. 6000-print-heads
           perf.. 2000-proc-a-label-set
              varying nbr-of-sets from +1 by +1
                until page-is-finished
           .
       2000-proc-a-label-set.
           move spaces to ws-set-area
           perf.. 3000-proc-a-label
              varying nbr-of-labels from +1 by +1
                until line-is-finished
           perf.. 6100-print-a-label-set
           .
       3000-proc-a-label.
           move input-data to output-rec-flda(nbr-of-labels)
           move input-data to output-rec-fldb(nbr-of-labels)
           .
           .
           .           
           etc., bump cntrs, etc.
           perf.. 7100-next-read.
           .
       .
       .
       .   
      7100-next-read.
          read input-file at end
               set eof-input to true
               move 99 to nbr-of-sets
               move  9 to nbr-of-labels
          not at end
               add +1 to ip-cnt
          end-read
          .

[code/]
 
Name 1-30
Sex 36
Marital status 37
Street address 40-55
City 56-70
State 71-72
Zip code 73-77


01 EMP REC.
05 NAME-IN PIC X (30).
05 GENDER-IN PIC X.
05 STATUS-IN PIC X.
05 STREET-IN PIC X(5).
05 CITY-IN PIC X(4).
05 STATE-IN PIC XX.
05 ZIP-IN PIC X(5).
*
*
FD EMP-REPORT
LABEL RECORDS ARE OMITTED
RECORD CONTAINS 132 CHARACTER.
*
*
01 REPORT-OUT PIC X(132).
*
*
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC XXX VALUE "YES"
*
*
01 MASTER-LINE-1
05 NAME-OUT PIC X (30).
05 GENDER-OUT PIC X.
05 STATUS-OUT PIC X.
05 STREET-OUT PIC X(5).
05 CITY-OUT PIC X(4).
05 STATE-OUT PIC XX.
05 ZIP-OUT PIC X(5).
*
*
PROCEDURE DIVISION.
000-MAIN-MODULE.
OPEN INPUT EMP-REC
OUTPUT EMP-REPORT
MOVE SPACES TO REPORT-OUT
PERFORM ARE-THERE-MORE-RECORDS = "NO"
READ EMP-REC
AT END MOVE "NO" TO ARE-THERE-MORE-RECORDS
NOT AT END PERFORM 200-PROCESS-MODULE
END-READ
END-PERFORM
CLOSE EMP-REC
EMP-REPORT
STOP RUN.
*
*
200-PROCESS-MODULE.
MOVE SPACES TO REPORT-OUT
AFTER ADVANCING 2 LINES
MOVE NAME-IN TO NAME-OUT
MOVE GENDER-IN TO GENDER-OUT
MOVE STATUS-IN TO STATUS-OUT
MOVE STREET-IN TO STREET-OUT
MOVE CITY-IN TO CITY-OUT
MOVE STATE-IN TO STATE-OUT
MOVE ZIP-IN TO ZIP-OUT
WRITE REPORT-OUT FROM MASTER-LINE-1
AFTER ADVANCING 2 LINES.

thread209-54539 I HOPE THIS WILL HELP YOU OUT IN SOME WAY GOODLUCK !!! rickmartin32






 
That is real good! Can you help with more?

YOU ARE TO WRITE A PROGRAM THAT WILL REPORT CUSTOMER PAYMENTS AGAINST A LOAN BY DATE.

PROGRAM WILL HAVE TWO INPUT FILES. THE FIRST FILE WILL CONSIST OF CUSTOMER ID, NAME AND THE BEGINNING BALANCE OF THEIR LOAN.

FILE 2 WILL CONTAIN THE PAYMENTS THAT HAVE BEEN MADE ON THE LOANS.

THE NAME FILE WILL BE LOADED INTO A DYNAMIC TABLE.

PROGRAM WILL PAGE BREAK ON CUSTOMER.

PROGRAM WILL ALSO HAVE A CONTROL BREAK ON YEAR (NO PAGE BREAK).

REPORT HEADING WILL USE THE EXPANDED REPORT DATE FORMAT
(MMM DD, CCYY) USE A MONTH TABLE FOR THE LITERAL..

REPORT DETAIL WILL BE:

CUST ID CUST NAME STARTING BALANCE

PAYMENT DATE BEGINNING BALANCE PAYMENT ENDING BALANCE
PAYMENT DATE BEGINNING BALANCE PAYMENT ENDING BALANCE

ETC

PAYMENT DATE WILL BE IN THE FORM OF LONG REPORT DATE (MM/DD/CCYY)

FILE 1:
1-5 CUSTOMER ID
6-25 CUSTOMER NAME
26-33 STARTING LOAN AMOUNT ( 9(06)V99 ).

FILE2:
1-5 CUSTOMER ID
6-11 PAYMENT DATE (YYMMDD)
12-19 PAYMENT ( 9(06)V99 )

FILES WILL BE SUPPLIED BY ME.
EXTRA CREDIT ( 10 POINTS )

CHARGE INTEREST EACH MONTH.
 
OK H,

I think its time to do your own homework. Maybe
if you showed us what you tried to do yourself,
some help may be forthcomming, otherwise, bye!

Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top