Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

French version / version Française

A frenche french version of this FAQ exists à the following address : https://portal.hardis-group.com/x/gYjWIg

...

Bloc de code
/* ___ Declarations _____________________________________________________________________
date        myDate1
date        myDate2
time_t      myTime1
time_t      myTime2
timestamp   myTimestamp1
timestamp   myTimestamp2
num_e(9,0)  myInterval1
num_e(9,0)  myInterval2
num_e(15,0) myInterval3

/* ___ Code _____________________________________________________________________________
myInterval1 = &date_interval(myDate1;myDate2)                /* number of days between myDate1 and myDate2 (can be a negative number if myDate1 if greater than myDate2)
myInterval2 = &time_interval(myTime1;myTime2)                /* number of seconds between myTime1 and myTime2 (can be a negative number if myTime1 if greater than myTime2)

myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'Y ')   /* number of years between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)
myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'M ')   /* number of months between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)
myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'D ')   /* number of days between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)
myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'H ')   /* number of hours between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)
myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'MI')   /* number of minutes between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)
myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'S ')   /* number of seconds between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)
myInterval3 = &tms_interval(myTimestamp1;myTimestamp2;'MS')   /* number of microseconds between myTimestamp1 and myTimestamp2 (can be a negative number if myTimestamp1 if greater than myTimestamp2)

Image

1 - Transforming an alpha variable to an image variable

...

3 - Extract informations from a Date variable

In order to extract informations from a Date variable, we can use the following functions

  • &Date_To_Year
  • &Date_To_Month
  • &Date_To_Day
  • &Date_To_Num


Bloc de code
/* ___ DeclarationsDéclarations _____________________________________________________________________
alpha(date 100) fileAlias
alpha(  10) fileMode
alpha(5000) myAlpha
image       myImagemyDate
num_bin_4e(4,0)  myYear
num_e(2,0)  myMonth
num_e(2,0)  myDay

/* ___ Code _____________________________________________________________________________
myYear      = &date_to_year(myDate)                            /* extract the year from the date myDate (year will be in format CCYY (century + year)  
myMonth     = &date_to_month(myDate)                           /* extract the month from the date myDate
myDay       = &date_to_day(myDate)                             /* extract the day from the date myDate
myDateNum   = &date_to_num(myDate)                             /* convert the date myDate to a numerical date (YYYYMMDD format)


...

Image

1 - Transforming an alpha variable to an image variable

If an image variable should contains a text, it is possible to transform the content of an alpha variable to an image variable in the following way : 

Bloc de code
/* ___ Declarations _____________________________________________________________________
alpha( 100) fileAlias
alpha(  10) fileMode
alpha(5000) myAlpha
image       myImage
num_bin_4   nb4ReturnCode

/* ___ Code _ nb4ReturnCode

/* ___ Code _________________________________________________________________________________
myAlpha   = 'my text to be transformed to an image variable (2205)
fileAlias = 'myTransformation'
fileMode  = 'w'

load_dll   'VATOOLBX.DLL'
call_dll   'VATOOLBX.DLL' 'VaToolBxOpenFile' fileAlias myImage fileMode nb4ReturnCode
call_dll   'VATOOLBX.DLL' 'VaToolBxWriteString' fileAlias myAlpha nb4ReturnCode
call_dll   'VATOOLBX.DLL' 'VaToolBxCloseFile' fileAlias nb4ReturnCode
unload_dll 'VATOOLBX.DLL'

/* the myImage variable now contains the alpha text from the myAlpha variable.

...

Bloc de code
/* ___ Declarations _____________________________________________________________________
alpha( 100) fileAlias
alpha(  10) fileMode
num_bin_4   fileSize
alpha(5000) myAlpha
image       myImage

num_bin_4   nb4ReturnCode

/* ___ Code _____________________________________________________________________________
fileAlias = 'myTransformation'
fileMode  = 't'
fileSize  = 5000

load_dll   'VATOOLBX.DLL'
call_dll   'VATOOLBX.DLL' 'VaToolBxOpenFile' fileAlias myImage fileMode nb4ReturnCode
call_dll   'VATOOLBX.DLL' 'VaToolBxWriteString' fileAlias myAlpha nb4ReturnCode
call_dll   'VATOOLBX.DLL' 'VaToolBxReadFile' fileAlias myAlpha fileSize nb4ReturnCode
call_dll   'VATOOLBX.DLL' 'VaToolBxCloseFile' fileAlias nb4ReturnCode
unload_dll 'VATOOLBX.DLL'

/* the myAlpha variable now contains the alpha text from the myImage variable.
/* the fileSize contains the real number of characters from the image variable.

...