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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mailing Labels

Status
Not open for further replies.

LadyPeeper

Programmer
Sep 8, 2000
8
US
I'm really new at this so here goes. If you need me to detail my question more then let me know.

I'd like to create some mailing labels that run four labels to each row. Each label has three lines and each label is a different record. So I would define my lines as Name1, Address1, Town1 for my first label, Name2, Address2, Town2 for my second label....up to label four, then the fifth label would end up under label one and it would continue left to right. I don't want to do a read, process, read, process, read, process thing with a lot of IF statements clearing it up. Maybe process current record then read next record but don't know how to set it up.

Anyway, any takers out there? Your guidance is helpful. :)
[sig][/sig]
 
Hi,

I guess you need something like:

01 PRINT-LINE-1.
03 FILLER OCCURS 4.
05 P1-NAME PIC X(24).
05 FILLER PIC X(5).
01 PRINT-LINE-2.
03 FILLER OCCURS 4.
05 P1-ADDRESS ......
ETC.

01 FILLER.
03 ADDRESS-INPUT OCCURS 4.
05 AI-NAME PIC X(24).
05 AI-ADDRESS ....
ETC.


If you first prepare 4 addresses in some space, you later on fill the print-lines.

something like:

perform varying sub from +1 by +1 until sub > +4
move ai-name(sub) to p1-name(sub)
....
end-perform
write ..... from p1.
write ..... from p2.
etc.

Even the print-lines can be part of a table.
[sig][/sig]
 
Hi there,

Can you tell me what this does:

perform varying sub from +1 by +1 until sub > +4
move ai-name(sub) to p1-name(sub)
....
end-perform
write ..... from p1.
write ..... from p2.
etc.

I may not be understanding the logic - it seems like it would place the 5th record on the first label of the second row. Am I following you right? If so, then this is good! I'm starting to learn.

Okay now, are the '+' signs necessary as I've seen numbers without the '+' sign, I'm assuming it's your convention, unless they're specifically put there for a reason.

I will research about Perform Varying. I was actually thinking of using a table (array) to output the labels but I want to do a little bit of testing but I launch into it.

Thanks for your reply, I'll be in here a lot to get ideas on how the pros design a program. :) [sig][/sig]
 
Hi,

I suggest you try to get something like book 'cobol from micro to mainframe' from Grauer-Villar / Prentice Hall, which contains also the CA-REALIA classroom cobol compiler and debugger and beautiful examples which you can see alive using the debugger, step by step. Then it is easy to understand what a perform until does, how tables are working, etc.

In the example above, I assume you have 4 addresses in the table above, with address 1 in element ADDRESS-INPUT (1) and address 2 in element ADDRESS-INPUT (2), etc.

The first line of each address is going to be in PRINT-LINE-1. The second line of each address into PRINT-LINE-2, etc.

This is the classic way to solve this problem.

If you work with something like AFP, you can define logical pages into you can print. Each mailing label can become a logic page. But it will take a lot of time to explain all those things, so to get a good understanding of COBOL, I realy advise you to use the book I mentioned before. I use it for my students!

+signs are used in combination with signed fields.

This was it for now. Have a nice reseach. Take also a look inside IBM's free manuals, pointed to at the location [sig][/sig]
 
Hey thanks for link to that site. Some of the links in there are dead but the ones that work have information that I'm definitely looking for.

Thanks again! :) [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top