Invoking Sort from assembler



High Level Assembler(HLASM) for MVS & VM & VSE

Re: Invoking Sort from assembler

Postby sensuixel » Fri Jul 27, 2012 12:22 pm

BillyBoyo wrote:
ASMSRCT2 CSECT                                                 
         INITL 12,EQU=R      BASE REG = 12, R15 = 15   
OPEN_FIC EQU  *                                               
         OPEN   (SORTIN,(INPUT))                               
         OPEN   (SORTOUT,(OUTPUT))                             
         LA      R1,PARLST LOAD ADDR OF PARAM POINTER IN R1   
         LINK    EP=SORT                                       
ENDFIC   CLOSE   SORTIN                                       
         CLOSE   SORTOUT 


It was the above that "threw" me :-)

sensuixel,

This is the latest DFSORT Application Programming Guide (ice1ca60), if your DFSORT is up-to-date.


The first part of my code (OPEN and CLOSE phase) come from an another program i'm working on, where I need to compare LRECL of INPUT and OUTPUT data set.

My first intention was to test the SORT part separately then bring back the code in my main program. ;)

Anyway thanks a lot for all your replies and for the updated documentation.

When i said "guess" I didn't mean to be rude, sorry if it was interpreted that way. ;)
sensuixel
 
Posts: 58
Joined: Mon Feb 21, 2011 8:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Invoking Sort from assembler

Postby dick scherrer » Fri Jul 27, 2012 7:44 pm

Hello,

When i said "guess" I didn't mean to be rude, sorry if it was interpreted that way.
We encounter many misunderstood communications here - not to worry - we eventually get it right :)
Hope this helps,
d.sch.
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: Invoking Sort from assembler

Postby steve-myers » Fri Jul 27, 2012 8:35 pm

Just a comment on style, not really substance.

You did
         LA    1,PARLIST
         LINK  EP=SORT

This works perfectly well, but you made two assumptions - safe assumptions as it happens, but still assumptions.
  1. The LINK macro uses register 1 to pass a parameter list to the load module it is linking to
  2. The LINK macro does not modify register 1
Actually, the LINK macro has two parameter lists.
  • The parameter list sent to the new program.
  • A parameter list the LINK service uses
An experienced programmer uses code like this -
         LINK  EP=SORT,MF=(E,PARLIST)
The LINK macro loads the address of the parameter list into register 1 just as you did. Many programmers do it this way -
         LA    1,PARLIST
         LINK  EP=SORT,MF=(E,(1))

Arguably this is safer because you are doing two things.
  • You are telling the LINK macro the parameter list address is in register 1 AND
  • Don't modify register 1
Now I don't like in line parameter lists, so I frequently write
         LA    1,PARLIST
         LINK  EP=SORT,MF=(E,(1)),SF=(E,LINKPARM)
         ...
LINKPARM LINK  SF=L,EP=SORT
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Invoking Sort from assembler

Postby steve-myers » Sat Jul 28, 2012 7:19 pm

I just looked at my last post, and realized my no inline parameter list was all wrong. What I really want is something like this -
         LINK  SF=(E,LINKPARM),MF=(E,PARMLIST)
         ...
LINKPARM LINK  SF=L,EP=SORT
PARMLIST CALL  ,(...),VL,MF=L
Actually, PARMLIST is not right for sort , but it is more or less correct as a generic call.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Previous

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post