HP3000-L Archives

June 2005, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Olav Kappert <[log in to unmask]>
Reply To:
Olav Kappert <[log in to unmask]>
Date:
Tue, 21 Jun 2005 13:16:50 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (362 lines)
Brian:

What I like to do is to set up a work area and a perform paragraph.

In the paragraph, check for what you need and do with evaluates or if or
something.

For example:

01  customer-info.
     02  customer-code    pic x(08).
     02  customer-name   pic x(30).
     02  customer-addr1  pic x(30).

and in the procedure division:

 customer-information.
        evaluate customer-code (1:1)
          when "1"  perform get-customer......
          when "2"  perform get-company......
         end-evaluate.
~~~~~~

Any code that you can put in a subroutine, can be inbedded into the
program, given the correct logice and
watching for variable assignments.

You can even determine if the paragram worked by setting up a
customer-status pic x(01) field and setting it to "f" before the
paragraph perform and making it true if the paragraph performs correctly.

Olav.



Brian Donaldson wrote:

>Tony:
>
>Thanks for the response. Yes, I agree with you. :-)
>
>Since my "solution" to turn a large 200+ lines of code into many smaller
>macros (which now works) I have noticed a significant increase in the
>program's compile time (probably a lot of bad stuff going on behind the
>scenes I don't know about) -- I also use OPTIMIZE=1 in the $control
>statement).
>
>
>So today I will start looking at converting these macros into callable
>subroutine(s) instead. That may help.
>
>Things never appear to be what they seem at first -- macros certainly *did*
>appear to be the optimum solution but on hindsight now -- maybe not...
>
>Thanks for the info, Tony.
>
>Brian.
>
>
>
>On Tue, 21 Jun 2005 11:48:38 +0100, Tony Summers
><[log in to unmask]> wrote:
>
>
>
>>Whilst we use Macros,  you sometimes have to decide when it's better to
>>convert a macro into a subroutine call.   You have to remember that a
>>macro is simply a quick way of inserting raw Cobol text into the source
>>just before it is compiled.  Just try to assess the impact of inserting
>>200 calls to a macro which, in turn was 200 lines long !
>>
>>-----Original Message-----
>>From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On
>>Behalf Of Olav Kappert
>>Sent: 21 June 2005 01:49
>>To: [log in to unmask]
>>Subject: Re: [HP3000-L] Cobol Macro Problem
>>
>>Brian:
>>
>>First of all, reading this code is difficult.
>>
>>Place all the macros up front in one place, and that they are defined
>>prior to its use, Make sure that the replacement value substituted into
>>the macro does not exceed the length of the line, Next check that all
>>macros are terminated by an #, and not continued onto the next line
>>without following the proper syntax, Next make sure that macro are not
>>recursive, because there is no specific method for terminating the macro
>>call sequence, Lastly, I would never make the replacement characters be
>>part of an variable or command, ie ab-!1-ef; in the past I have had
>>various unexplained problems.
>>
>>The last suggestion, I would do a small test to make sure that every is
>>as wanted.
>>
>>For my very last comment, display the compiled source, and check to see
>>what it is doing.....
>>
>>Olav.
>>
>>
>>Brian Donaldson wrote:
>>
>>
>>
>>>I have about 200+ lines of code that really need to be in a macro.
>>>
>>>Only two parms are being passed into the macro but the amount of code
>>>is what I think is killing me.....
>>>
>>>The error is:
>>>
>>>PAGE 0001  COBOL II/iX HP31500A.04.21  [85] Copyright Hewlett-Packard
>>>
>>>
>>CO.
>>
>>
>>>1987
>>>
>>>LINE #   SEQ # COL ERROR SEV            TEXT
>>>-----------------------------------------------------------------------
>>>-----
>>>--
>>>11328  683200  12  390  Q  COMPILER ERROR: UNIMPLEMENTED CASE 12350 in
>>>                           PROCEDURE GET'MACRO - array MACROTEXT too
>>>
>>>
>>small.
>>
>>
>>>*** FATAL ERROR TABLE OVERFLOW ***
>>>11328  683200  12  461  D  DYNAMIC ARRAY ERROR, OUT OF SPACE.
>>>
>>>1 ERROR(s), 1 QUESTIONABLE, 0 WARNING(s)
>>>*** COMPILATION TERMINATED ***
>>>procedure STACK_TRACE
>>>DEBUG/iX C.25.06
>>>
>>>HPDEBUG Intrinsic at: 244.001724dc stack_trace+$9c
>>>      PC=244.001724dc stack_trace+$9c
>>>NM* 0) SP=4185e9f8 RP=244.00173334 abnormal_termination+$16c NM  1)
>>>SP=4185e898 RP=244.00173994 error+$3ec NM  2) SP=4185e7b8
>>>RP=244.00173398 simple_error+$30 NM  3) SP=4185e4f8 RP=244.0013cce8
>>>pp_warn+$c4 NM  4) SP=4185e4b0 RP=244.0013ee18 get_macro+$b4 NM  5)
>>>SP=4185e400 RP=244.0013e3e0 check_ppid+$44 NM  6) SP=4185b2d8
>>>RP=244.001416d0 process_source+$300 NM  7) SP=4185b290 RP=244.001417e4
>>>get_record+$68 NM  8) SP=4185b1c8 RP=244.001367e8 get_source_rec+$34 NM
>>>
>>>
>>>9) SP=4185b190 RP=244.0013676c peek_source+$19c NM  a) SP=4185b0f0
>>>RP=244.00132110 get_exp_source+$148 NM  b) SP=4185b098 RP=244.00132ea8
>>>do_pass_0+$d0 NM  c) SP=4185af60 RP=244.001335ac ANSI74+$18c NM  d)
>>>SP=41854258 RP=244.00000000
>>>    (end of NM stack)
>>>
>>>   CHECKED SYNTAX ONLY.
>>>   CPU TIME = 0:00:05.  WALL TIME = 0:01:03.
>>>
>>>run COBOL.PUB.SYS,ANSI85;parm=7;info=""
>>>Program terminated in an error state. (CIERR 976) ERRORS IN COMPILE
>>>  setjcw jcw=fatal
>>>Unless a CONTINUE is in effect, the remainder of the current UDC will
>>>be flushed. (CIWARN 1723)
>>>
>>>Sample of the code is:
>>>
>>>Mainline calling the macro:
>>>
>>>    COPY FDBFHBLD OF VMACRO.
>>>    %LOADFDBFHB(FDB#,DETAIL#)
>>>    COPY FDBFHBL2 OF VMACRO.
>>>    %LOADFDBFHB2(FDB#,DETAIL#)
>>>    COPY FDBFHBL3 OF VMACRO.
>>>    %LOADFDBFHB3(FDB#,DETAIL#)
>>>
>>>Sample code in the macro:
>>>
>>>$CONTROL NOLIST
>>>$PREPROCESSOR DELIMITER=~
>>>$DEFINE %LOADFDBFHB1=
>>>    MOVE SPACES         TO PAGE-005-FILE-!2-REC.
>>>    MOVE DB-!1-VA-LEFT  TO WS-VAD-LEFT.
>>>    MOVE DB-!1-VA-RIGHT TO WS-VAD-RIGHT.
>>>    STRING "Virtual Addr (DEC): " DELIMITED BY SIZE
>>>           WS-VAD-LEFT            DELIMITED BY SIZE
>>>           " "                    DELIMITED BY SIZE
>>>           WS-VAD-RIGHT           DELIMITED BY SIZE
>>>      INTO PAGE-005-FILE-!2-REC
>>>    END-STRING.
>>>    MOVE WS-PAGE-NO-005 TO PAGE-005-PAGE-NO.
>>>    MOVE WS-LINE-NO-005 TO PAGE-005-LINE-NO.
>>>    COPY VMACRO0 OF VMACRO.
>>>    %WRITEPAGERECORD(005#,49#,3000-EDIT-ERR#)
>>>    COPY VMACROA OF VMACRO.
>>>    %PAGEINCR(005#,3000-EDIT-ERR#).
>>>    ADD 1 TO WS-ENTRIES-SELECTED.
>>>
>>>    INITIALIZE WS-UFIDS-TABLE.
>>>    MOVE DB-!1-VA-LEFT            TO WS-UFIDS(1).
>>>    MOVE DB-!1-VA-RIGHT           TO WS-UFIDS(2).
>>>    MOVE SPACES                   TO WS-UFIDS-HEX-TABLE
>>>                                     WS-VAD-LEFT-X
>>>                                     WS-VAD-RIGHT-X.
>>>    CALL "Convert_UFIDS_To_Hex" USING WS-UFIDS-TABLE,
>>>                                      WS-UFIDS-HEX-TABLE
>>>    END-CALL.
>>>    COMPUTE WS-SUB = FUNCTION LENGTH(WS-VAD-LEFT).
>>>    MOVE WS-SUB TO WS-SUB-A.
>>>    PERFORM VARYING WS-SUB FROM WS-SUB BY -1
>>>              UNTIL WS-SUB < 1
>>>       IF WS-UFIDS-HEX-X (1)(WS-SUB:1) NOT = SPACES THEN
>>>          MOVE WS-UFIDS-HEX-X (1)(WS-SUB:1)
>>>            TO WS-VAD-LEFT-X     (WS-SUB-A:1)
>>>          SUBTRACT 1 FROM WS-SUB-A
>>>       END-IF
>>>    END-PERFORM.
>>>    COMPUTE WS-SUB = FUNCTION LENGTH(WS-VAD-RIGHT).
>>>    MOVE WS-SUB TO WS-SUB-A.
>>>    PERFORM VARYING WS-SUB FROM WS-SUB BY -1
>>>              UNTIL WS-SUB < 1
>>>       IF WS-UFIDS-HEX-X (2)(WS-SUB:1) NOT = SPACES THEN
>>>          MOVE WS-UFIDS-HEX-X (2)(WS-SUB:1)
>>>            TO WS-VAD-RIGHT-X    (WS-SUB-A:1)
>>>          SUBTRACT 1 FROM WS-SUB-A
>>>       END-IF
>>>    END-PERFORM.
>>>    MOVE SPACES TO PAGE-005-FILE-!2-REC.
>>>    STRING "Virtual Addr (HEX): " DELIMITED BY SIZE
>>>           WS-VAD-LEFT-X          DELIMITED BY SIZE
>>>           " "                    DELIMITED BY SIZE
>>>           WS-VAD-RIGHT-X         DELIMITED BY SIZE
>>>      INTO PAGE-005-FILE-!2-REC
>>>    END-STRING.
>>>    MOVE WS-PAGE-NO-005 TO PAGE-005-PAGE-NO.
>>>    MOVE WS-LINE-NO-005 TO PAGE-005-LINE-NO.
>>>    COPY VMACRO0 OF VMACRO.
>>>    %WRITEPAGERECORD(005#,49#,3000-EDIT-ERR#)
>>>    COPY VMACROA OF VMACRO.
>>>    %PAGEINCR(005#,3000-EDIT-ERR#).
>>>    ADD 1 TO WS-ENTRIES-SELECTED.
>>>
>>>    MOVE SPACES         TO PAGE-005-FILE-!2-REC.
>>>    MOVE WS-PAGE-NO-005 TO PAGE-005-PAGE-NO.
>>>    MOVE WS-LINE-NO-005 TO PAGE-005-LINE-NO.
>>>    COPY VMACRO0 OF VMACRO.
>>>    %WRITEPAGERECORD(005#,49#,3000-EDIT-ERR#)
>>>    COPY VMACROA OF VMACRO.
>>>    %PAGEINCR(005#,3000-EDIT-ERR#).
>>>    ADD 1 TO WS-ENTRIES-SELECTED.
>>>
>>>    MOVE SPACES          TO PAGE-005-FILE-!2-REC.
>>>    MOVE DB-!1-REC-SIZE TO WS-REC-SIZE-DISP.
>>>    STRING "Record Size(Bytes): " DELIMITED BY SIZE
>>>           WS-REC-SIZE-DISP       DELIMITED BY SIZE
>>>      INTO PAGE-005-FILE-!2-REC
>>>    END-STRING.
>>>    MOVE WS-PAGE-NO-005 TO PAGE-005-PAGE-NO.
>>>    MOVE WS-LINE-NO-005 TO PAGE-005-LINE-NO.
>>>    COPY VMACRO0 OF VMACRO.
>>>    %WRITEPAGERECORD(005#,49#,3000-EDIT-ERR#)
>>>    COPY VMACROA OF VMACRO.
>>>    %PAGEINCR(005#,3000-EDIT-ERR#).
>>>    ADD 1 TO WS-ENTRIES-SELECTED.
>>>            etc etc......
>>>
>>>Anyone got suggestions how to fix this problem and make the macro work?
>>>
>>>TIA,
>>>Brian.
>>>
>>>* To join/leave the list, search archives, change list settings, *
>>>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>>>
>>>
>>>
>>>
>>>
>>* To join/leave the list, search archives, change list settings, *
>>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>>
>>______________________________________________________________________
>>This email has been scanned by the MessageLabs Email Security System.
>>For more information please visit http://www.messagelabs.com/email
>>______________________________________________________________________
>>
>>
>>The contents of this email are confidential to the intended recipient
>>and may not be disclosed. Although it is believed that this email and
>>any attachments are virus free, it is the responsibility of the recipient
>>
>>
>to confirm this.
>
>
>>Smith & Williamson Corporate Finance Limited - A member of M&A
>>International Inc. http://www.mergers.net Registered in England No.
>>4533970. Authorised and regulated by the Financial Services Authority
>>Smith & Williamson Investment Management Limited, Registered No. 976145.
>>
>>
>Authorised and regulated by the Financial Services Authority.
>
>
>>Smith & Williamson Pension Consultancy Limited - Independent
>>Intermediary. Registered No. 3133226. Authorised and regulated by the
>>Financial Services Authority.
>>Smith & Williamson Fund Administration Limited, Registered No. 1934644.
>>
>>
>Authorised and regulated by the Financial Services Authority.
>
>
>>Smith & Williamson Limited - A member of Nexia International.
>>Registered in England No. 4534022. Regulated by the Institute of
>>Chartered Accountants in England & Wales for a range of investment
>>business activities.
>>
>>Registered Office: No 1 Riding House Street, London W1A 3AS
>>Telephone: 020 7637 5377 http://www.smith.williamson.co.uk
>>
>>Nexia Audit Limited - A member of Nexia International. Registered in
>>England No. 4469576. Registered to carry on audit work and regulated by
>>
>>
>the Institute of Chartered Accountants in England & Wales for a range of
>investment business activities.
>
>
>>Registered Office: No 1 Riding House Street, London W1A 3AS
>>Telephone: 020 7637 5377 http://www.nexiaaudit.co.uk
>>
>>NCL Investments Limited, Registered No. 1913794.
>>Member of the London Stock Exchange authorised and regulated by the
>>
>>
>Financial Services Authority.
>
>
>>Registered Office: Bartlett House, 9-12 Basinghall Street, London  EC2V 5NS
>>Telephone: 020 7600 2801
>>
>>
>>______________________________________________________________________
>>This email has been scanned by the MessageLabs Email Security System.
>>For more information please visit http://www.messagelabs.com/email
>>______________________________________________________________________
>>
>>* To join/leave the list, search archives, change list settings, *
>>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>>
>>
>
>* To join/leave the list, search archives, change list settings, *
>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
>
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2