Removing blank address lines from report



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Removing blank address lines from report

Postby needhelp » Wed Jun 08, 2011 1:19 am

How do you remove blank address lines and move the city state zip line up? There can be up to 4 address lines but I only want to print the address lines that have data. The data is coming in on 1 record. I was hoping to find a 'conditional' line command but can't find anything in the manual. Am I going to have to do this in COBOL?

Need this:
Jim Jones
123 Main st
PO Box 123


Anytown, US 12345

to remove blank lines and move up:
Jim Jones
123 Main st
PO Box 123
Anytown, US 12345
needhelp
 
Posts: 21
Joined: Thu Dec 30, 2010 9:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Removing blank address lines from report

Postby dick scherrer » Wed Jun 08, 2011 2:04 am

Hello,

OMIT the blank lines. . . The others will automagically "move up".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Removing blank address lines from report

Postby BillyBoyo » Wed Jun 08, 2011 2:07 am

There can be lots of ways. Also, sometimes, a general report-writer is not so good at a highly specfic task. What does your report specifcation look like?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing blank address lines from report

Postby dick scherrer » Wed Jun 08, 2011 2:36 am

Oops . . Sorry, i was answering as though this was a SORT question. . . :oops:

Yes, it depends on how the report is produced/defined.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Removing blank address lines from report

Postby needhelp » Wed Jun 08, 2011 3:06 am

When I run this, the blank lines show up, do I need to code this another way? If there is nothing in address-line2, 3 or 4 I don't want those lines to print, if there is something there, I want them to print.

JOB INPUT INFILE
IF EOF INFILE
STOP
END-IF
PRINT REPORT1
REPORT REPORT1 PAGESIZE 55 SKIP 1 PRINTER (REPORT1) LINESIZE 132
HEADING ( 'ADDRESS')
LINE 1 ADDRESS-LINE1
LINE 2 ADDRESS-LINE2
LINE 3 ADDRESS-LINE3
LINE 4 ADDRESS-LINE4
LINE 5 ADDRESS-CITY ADDRESS-STATE
LINE 6 ZIP10
needhelp
 
Posts: 21
Joined: Thu Dec 30, 2010 9:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Removing blank address lines from report

Postby dick scherrer » Wed Jun 08, 2011 3:20 am

Hello,

One way to do this would be to define a set of ws variables (w1 - w5) in an array and move the "address line" to the "current line". Each time an address value is moved, increment the array subscript. Set the supbscript to 1 each tme a new record is read.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Removing blank address lines from report

Postby BillyBoyo » Wed Jun 08, 2011 4:37 am

needhelp wrote:When I run this, the blank lines show up, do I need to code this another way? If there is nothing in address-line2, 3 or 4 I don't want those lines to print, if there is something there, I want them to print.

JOB INPUT INFILE
IF EOF INFILE
STOP
END-IF
PRINT REPORT1
REPORT REPORT1 PAGESIZE 55 SKIP 1 PRINTER (REPORT1) LINESIZE 132
HEADING ( 'ADDRESS')
LINE 1 ADDRESS-LINE1
LINE 2 ADDRESS-LINE2
LINE 3 ADDRESS-LINE3
LINE 4 ADDRESS-LINE4
LINE 5 ADDRESS-CITY ADDRESS-STATE
LINE 6 ZIP10


A table, as Dick has said, will clear your initial problem.

The next problem might be, well, that method leaves a load of blank lines in between addresses.

If you don't want that:
JOB INPUT INFILE +
   NAME PRODUCE-ADDRESS-REPORT-FROM-ALL-INPUT

    PRINT REPORT1

REPORT REPORT1 +
   PAGESIZE 55 +
   SKIP 1 +
   PRINTER REPORT1 +
   LINESIZE 132     

HEADING  'ADDRESS'

LINE 1  ADDRESS-LINE1             

AFTER-LINE. PROC

    IF ADDRESS-LINE2 NE " "
          DISPLAY +
                POS 1 +
                ADDRESS-LINE2
    END-IF
         
    IF ADDRESS-LINE3 NE " "
          DISPLAY +
                POS 1 +
                ADDRESS-LINE3
    END-IF

    IF ADDRESS-LINE4 NE " "
          DISPLAY +
                POS 1 +
                ADDRESS-LINE4
    END-IF
         
    IF ADDRESS-CITY NE " "
          DISPLAY +
                POS 1 +
                ADDRESS-CITY
                ADDRESS-STATE
    ELSE
          IF ADDRESS-STATE NE " "
              DISPLAY +
                    POS 1 +
                    ADDRESS-STATE
          END-IF
    END-IF

END-PROC


I removed your IF EOF, because that is handled automatically by the JOB statement, so yours would never be executed (it is necessary with JOB INPUT NULL and your own GETs).

I have also made it look a bit more pretty.

The problem this gives you is the end-of-page processing. Lucky for you, Easytrieve now supports access to the LINE-COUNT (number of lines printed).

There is more than one way to go about dealing with this, so it is time for you to have a go if you fancy it. Note, you might feel the need to replace my if's with Dick's solution in the after-line. proc. Feel free.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing blank address lines from report

Postby dick scherrer » Wed Jun 08, 2011 7:01 am

Hello,

The next problem might be, well, that method leaves a load of blank lines in between addresses.

Yup, if the output is for mailing labels or something similar, the spacing might be needed. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Removing blank address lines from report

Postby BillyBoyo » Wed Jun 08, 2011 12:17 pm

Indeed might be. Easytrieve has a special report type for LABELS. Your method plus that, big box ticked/checked in no time.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing blank address lines from report

Postby needhelp » Wed Jun 08, 2011 6:33 pm

Thank you for the suggestions, I am fairly new to easytrieve and not sure how to change my COBOL thinking to easytrieve thinking. There is a bit more involved in the report but that was the basic problem I was having, the extra lines look bad. I will give these a try.
needhelp
 
Posts: 21
Joined: Thu Dec 30, 2010 9:37 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post