Conversion of assembler to Easytrieve



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

Conversion of assembler to Easytrieve

Postby Ramanath » Tue Mar 08, 2011 3:39 pm

Hi,
Can anyone help on this. Please convert the following assembler code into Easytrieve.


         MVC   0(255,RZ),0(RX)   COPY INPUT TO OUTPUT AREA         
         MVC   255(95,RZ),255(RX) COPY REMAINING INPUT TO OUTPUT   
         CLI   0(RX),C'H'        CHECK FOR HEADER RECORD           
         BE    50                                                 
         CLI   0(RX),C'B'        CHECK FOR BATCH RECORD           
         BE    40                                                 
         CLI   0(RX),C'T'        CHECK FOR TRAILER RECORD         
         BE    60                                                 
         LA    RV,32             LENGTH OF FIRST NAME FIELD       
01       NULL                    PROCESS DETAIL RECORD             
         LA    RW,48(RV,RZ)      START OF FIRST NAME FIELD +       
         NULL                        REMAINING LENGTH             
         CLI   0(RW),C' '        IF NOT BLANK GO TO 10             
         BNE   10                  ELSE                           
         BCT   RV,01             DECREMENT LENGTH AND LOOP         
10       NULL                                                     
         MVC   2(32,RW),313(RX)                                   
         MVC   80(32,RZ),80(RX)  COPY STARTING AFTER NAME FIELD   
         MVC   313(32,RZ),=C'                                '       
         CP    TALLY3,=P'1'      IF PROCESSING RETURNS BATCH         
         BE    20                                                   
         AP    TALLY5,=P'1'      ADD 1 TO PAYMENTS COUNT             
         B     30                                                   
20       AP    TALLY6,=P'1'      ADD 1 TO RETURNS COUNT             
30       NULL                                                       
         LH    RV,=H'350'        SET OUT RECORD LENGTH               
         STH   RV,LENZ                                               
         B     50                                                   
40       NULL                                                       
         CLI   16(RZ),C'D'       IS THIS A RETURNS BATCH?           
         BE    45                                                   
         ZAP   TALLY3,=P'0'      SET RETURNS BATCH SWITCH OFF       
         B     50                C INDICATES CREDIT BATCH (PAYMENTS)
45       NULL                    D INDICATES DEBIT BATCH (REVERSALS)
         ZAP   TALLY3,=P'1'      SET RETURNS BATCH SWITCH ON         
50       NULL                                                       
         AP    TALLY1,=P'1'      ADD 1 TO NUMBER OF RECORDS         
         BAL   SYSUT2(RZ)        WRITE THE RECORD                   
         B     DELETE(RX)        READ NEXT SYSUT1                   
60       NULL                                                       
         AP    TALLY1,=P'1'      ADD 1 TO NUMBER OF RECORDS         
         UNPK  1(10,RZ),TALLY1   MOVE NUMBER OF RECORDS TO TRAILER 
         OI    10(RZ),X'F0'      FORCE SIGN TO F                   
         LH    RV,=H'350'        SET OUT RECORD LENGTH             
         STH   RV,LENZ                                             
         BAL   SYSUT2(RZ)        WRITE THE TRAILER RECORD           
         B     DELETE(RX)        IF OK, READ NEXT SYSUT1           
*                                                                   
EOFX     NULL  ,                                                   
         B     EOF                                                 
         END
Ramanath
 
Posts: 7
Joined: Thu Feb 17, 2011 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Conversion of assembler to Easytrieve

Postby enrico-sorichetti » Tue Mar 08, 2011 4:15 pm

this is a HELP forum, not a DO IT FOR ME one
and the code sequence You are showing is not assembler
they are the control cards for an old EDS utility WAAPDSUT
( which was supposed to be EDS internal use only, but for some reason was left behind in some customer locations)

also when asking for help You should post a description of Your issue,
not just throw a piece of <code> and expect people to ...
interpret it to understand it' s workings
translate it into a requirement/clear description
rewrite it for you

aren' t You expecting too much from people who
reply on their own time and free of charge :evil:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Conversion of assembler to Easytrieve

Postby steve-myers » Tue Mar 08, 2011 6:28 pm

Of course, if you're willing to HIRE one of us, post your proposed rate and someone may respond.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Conversion of assembler to Easytrieve

Postby BillyBoyo » Tue Mar 08, 2011 9:25 pm

I'm queuing behind Steve. You have almost every line commented. At least if not offering to pay, have a go yourself. Left shift, right shift, you get rid of the "assembler", turn the comments into Easytrieve by hand. Best if you pay, though :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Conversion of assembler to Easytrieve

Postby enrico-sorichetti » Wed Mar 09, 2011 1:56 am

the main issue with the comments is that the are the <useless> kind
the useful comments are those briefly describing the process...
anybody can realize that AP TALLYsomething,=P'1' increments some counter
nicer to know the counting logic...
but as usual we expect too much :D
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Conversion of assembler to Easytrieve

Postby BillyBoyo » Wed Mar 09, 2011 2:20 am

Normally I'd totally agree with you. I think "comments" which simply re-state what the code does are not only pointless, but get in the way and can lead to problems... someone "clones" the program, and doesn't change all the idiotic comments but changes the code... now the comments are "wrong".

However, in this case, the comments are closer to the code that is needed to be written. A quick check that the comment does do what the code seems to be saying (depending on level of knowledge) and up pops a program in Easytrieve (or whatever selected language).

I like descriptive datanames and lables/procedures. When I comment, it is only where I feel I cannot otherwise make the code clear enough, or for something important but not directly to do with the code (ie. * OTC Options use this as input to their valuations - do not amend before liasing with them well in advance!).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Conversion of assembler to Easytrieve

Postby dick scherrer » Wed Mar 09, 2011 2:52 am

Hello,

It may be that TS is also not familiar with Easytrieve. . .

As previously suggested, it would be a good thing to "rent" someone to get this started (depending on how much conversion is to be done).

If there is only this one (or only a few) suggest that a very small input test file be created and the process run. Between the output data and the code/comments it should not be difficult to convert to Easytrieve, COBOL, or whatever.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Conversion of assembler to Easytrieve

Postby BillyBoyo » Wed Mar 09, 2011 2:42 pm

Could be, Dick.

FILE INFILE definition-I-don't-know
     INFILE-RECORD-TYPE 1 1 A

FILE OUTFILE definition-I-don't-know
* Important, sign F is needed, so no decimal places (to make a signed integer, put 0 for decimal places)
     TRAILER-RECORD-COUNT 2 7 N

* THERE ARE MANY WAYS TO DO THIS

* The following will automatically read your input file, pass through the available code following, then read the next, until end of file.
JOB INPUT INFILE


      MOVE INFILE TO OUTFILE

* Batch records, more of these than headers and trailers, so ask about these first.
      IF INFILE-RECORD-TYPE = "B"
           PERFORM BATCH-PROCESSING
           GO TO JOB
      END-IF



* Header, write it out. Easytrieve plus can automatically do record counts. Add extras if you like. I like to check that ther is one, and one only, header per file, and it is nice if there is a date on the header so I know I'm using the current file. Other info is also good. If any is there, use it as well.

      IF INFILE-RECORD-TYPE = "H"
*          PERFORM HEADER-PROCESSING
           PUT OUTFILE
           GO TO JOB
      END-IF


* Trailer, write it out. Easytrieve plus can automatically do record counts. Add extras if you like. I like to check that there is one, and one only, trailer per file, and it is nice to at least check a record total. Other info is also good. If any is there, use it as well.

      IF INFILE-RECORD-TYPE = "T"
           PERFORM TRAILER-PROCESSING
           GO TO JOB
      END-IF

* It would be nice if this detail record had a code. Then, as they will be mostly details, we can put this first, plus check that there are no "rubbish" record types on the file.

      PERFORM DETAIL-PROCESSING

* now, the program does its own "go to job" as there is no more code to process (we have reached the PROCs, could also be a report, another job, a sort, same thing happens, it just starts the input cycle again itself.

BATCH-PROCESSING. PROC
END-PROC
DETAIL-PROCESSING. PROC
* do all the stuff you need
      PUT OUTFILE
END-PROC
TRAILER-PROCESSING. PROC
       TRAILER-RECORD-COUNT = OUTFILE (RECORD-COUNT) + 1
       OUTFILE (RECORD-LENGTH) = 350
       PUT OUTFILE
END-PROC
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post