SabreTalk Migration

Semantic Designs can provide your organization with highly accurate automated conversion of legacy SabreTalk applications to C, C++ or other languages such as Java and C#. Our SabreTalk translator is built on top of Semantic Designs' advanced configurable compiler technology DMS®. With DMS, we are able to translate legacy programming technologies at a fraction of the cost and time of a manual rewrite.

Click to Request Translator Demonstration

SabreTalk Translation Highlights:

Flexibility

  • Freedom to choose target technologies
  • No third party dependencies
  • Translate multiple & mixed languages

Code Quality

  • Translations based on in-depth code analysis
  • Smart heuristics for code refactoring
  • Elimination of gotos
  • Removal of dead and redundant code

Efficiency with 99+% Automation

  • Shorter project timeframes lower costs & risk
  • No code freeze until cut over
  • Translate multiple & mixed languages

Converts SabreTalk-with-Prisym

  • SabreTalk declarations/code converted to maintainable C/C++
  • Folds multiple modules into single module
  • Replaces macros with defined C/C++ equivalents

Experience

  • Project team of PhD. Computer Scientists
  • Proven track record
  • Decades of investment in DMS

A key concern is, What will translated code look like? Weak translators convert code blindly line-by-line, with virtually no understanding of how the context of the code should shape its translation. Such translated code preserves the properties of the original SabreTalk, sometime the point of even preserving the syntax. Even if such code works, it not be maintainable and will ultimately cost the organization sorely.

Semantic Designs translators parse the original code with tools that have the same understanding as the original compilers.

A SabreTalk program translation

Here we show you a small sample of SabreTalk translated to C by SD's translation technology. Click here to see the the C code generated.

A simple SabreTalk program

We have chosen to provide a small SabreTalk program to prevent the reader from being overwhelmed by the complexities that occur in real examples.

OPTIONS=TRACE
 FINDCUST: PROC;
   /* TINY SABRETALK PROGRAM */
   %INCLUDE EB0EB,SW00SR,INVDB,INVCES;
   DCL FOUND BIT(32);
   DCL CUSTNAME CHAR(64) BASED(CUSTPTR);
   DCL BUFFER CHAR(100) BASED(BUFPTR);
   DCL INVPTR BIT(32);
   DCL DEADVAR BIT(32);
   DCL SUB BIN(15) DEF EBW096;
   /**************************/
   START (CUSTPTR=#RG1);
   INVDBPTR = INVDBCR2;
   BSTR(BUFFER,1,1) = 0;
   CSTR(BUFFER,2,99) = CSTR(BUFFER,1,99);
   BSTR(EBSW01) = '00'X;      
   INVPTR = INVDBA90(SUB);
 FNDEAD: FOUND=0;             
   IF INVPTR = 0          
      THEN GOTO FNDC45;    
   GOTO FNDOPEN;
 FNDREAD: DBRED 'REF=INVCES','REG=R1',
       KEY1=(PKY=#INVCESK), 
       UP,BEGIN,ERRORA=FNDC45  
       (#RG1=INVPTR,#RG3=SW0PTR, 
       SW0PTR=#RG3,INVPTR=#RG1); 
   IF SW00RTN > 0         
      THEN GOTO FNDC45; 
   CALL SETFOUND;
 FNDC45: DBCLS 'REF=INVCES',RELFC 
           (SW0PTR=#RG3);         
 EXIT:
   BACKC(#RG1=BUFPTR);          
 FNDOPEN: DBOPN 'REF=INVCES','REG=R1',
            FADDR=?INVPTR,HOLD
            (SW0PTR=#RG3);
 GOTO FNDREAD;

 SETFOUND: PROC;
   FOUND = 1;
 END SETFOUND;

 DEADPROC: PROC;
   FOUND = 0;
 END DEADPROC;

 END FINDCUST;

Each client has different goals and these can change the chosen target technology.

  • Target language of C, C++, Java or C#.
  • Mapping of Sabretalk concepts, including embedded assembler code, system macros, and TPFDF macros.
  • Mapping of database queries to the client's database of choice.
  • Staying on TPF or moving to a cloud-based solution.

One should note that the translator should chose fixed data types for variables compatible with their usage in the Sabretalk program or the database schema, but with a different or detailed representation better suited for for the target language.

Which combination of choices is made can determine very different style of translated code. The translator needs to be configured to account for the client's target technology choices.

SabreTalk program automatically translated to C

This output is reproduced exactly as SD's translator (configured for targetting the C code for running on a TPF system, and interacting with other existing program segments in HLASM and C) The translator produces nicely formatted target language code as a standard by-product.

Click here to see original SabreTalk program

/* OPTIONS=TRACE */
#include …/* TINY SABRETALK PROGRAM */
#include 
#include 
#include 
#include 
static void setfound(ULong4_t * const found);

void findcust(struct TPF_regs *regs_)
{ regs_->r1 =  (long int)findcust_((char (*)[64])regs_->r1);
}

char (*findcust_(char (*custptr)[64]))[100]
{ struct sw00sr *sw0ptr = NULL;
  INVDB_t *invdbptr = NULL;
  INVREC_t *invptr = NULL;
  ULong4_t found = 0x0;
  char (*bufptr)[100] = NULL;
  ULong4_t invptr = 0x0;
  Short2_t * const sub =
  (Short2_t *)&ecbptr()->ebw096;
  /**************************/
  invdbptr = (INVDB_t *)ecbptr()->invdbuf;
  *(UChar_t *)bufptr &= ~ 0x80;
  memcpy(& ((char *)bufptr)[1], bufptr, 99);
  ecbptr()->ebsw01 = 0x0;
  invptr = invdbptr->invreca[*sub - 1].invb70;
  found = 0;
  if (invptr != 0)
    { sw0ptr = dfopn_acc(“INVCES", INVCES_ID,
                   DFOPN_FADDR, DFOPN_HOLD, invptr);
      dft_kyl keys_;
      memset(&keys_, 0, sizeof keys_);
      df_setkey(&keys_, 1,
	  offsetof(invdbrec_t, invcesk),
	  member_size(invdbrec_t, invcesk),
	  DF_EQ, 0, invdbrec, DF_UPORG, DF_CONST);
      dfkey_nbr(sw0ptr, &keys_, 1);
      invptr = (INVREC_t *)dfred(sw0ptr,
	  DFRED_BEGIN);
      if (! DF_ER(sw0ptr)
          && sw0ptr->sw00rtn == 0)
        { setfound(&found);
        }
    }
  sw0ptr = dfifb_ref("INVCES");
  dfcls(sw0ptr, DFCLS_RELFC);
  return bufptr;
}

static void setfound(ULong4_t * const found)
{ *found = 1;
}

Click here to see original SabreTalk program

One can get good code like the above, from a translator, if one has the right foundation technology such as SD's DMS Software Reengineering Tookit®. As a practical matter, you can't get good code from an off the shelf translator, because every application system has unique properties: languages, OS features, scripting languages, screens, databases, and a correspondingly unique set of target technologies as decided by the client. It takes some effort to configure DMS for the client's particular source and target software configurations. The effort is rewarded by the maintainability of the result.

Configuring a custom migration tool to match client needs

Semantic Designs can provide custom configuration of migration tools and migration support to your organization, providing high quality, maintainable code translations.

For more information: info@semanticdesigns.com    Follow us at Twitter: @SemanticDesigns

Sabretalk
Migration