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.

...

Bloc de code
/* ___ Déclarations _____________________________________________________________________
ALPHA( 10) wLeft 
ALPHA( 10) wRight
ALPHA( 20) wText1 
ALPHA( 20) wText2 
ALPHA( 20) wText3 

/* ___ Code _____________________________________________________________________________
wLeft  = 'Hello'
wRight = 'World' 
wText1 = wLeft //  wRight						/* wText1 = 'Hello     World     '
wText2 = wLeft /// wRight						/* wText2 = 'HelloWorld          '
wText3 = wLeft /// ' ' // wRight				/* wText3 = 'Hello World         '

2 -

...

Connaître la taille d'une chaîne de caractères

...


Pour connaître la taille d'une chaîne de caractèresAfin de découper une chaine de caractères en différentes chaînes (en une liste de chaines en réalité) par rapport à un séparateur, il suffit d'utiliser l'instruction SCINDERla fonction prédéfinie &LONGUEUR_CHAINE :

Bloc de code
/* ___ Déclarations _____________________________________________________________________
alpha(num_bin_2  50) elementDay
liste       lst_days elementDay stringLength
alpha(1000100)  myDaysmyString

/* ___ Code _____________________________________________________________________________
myDaysmyString      = 'Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturdayalpha beta'  
scinder_chainestringLength  myDays ';' lst_days  	= &longueur_chaine(myString)
    /* lastringLength liste "lst_days" contiendra 7 éléments : 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'

3 - Remplacer une partie de chaine de caractères

a pour valeur 10

3 - Découper une chaine de caractères par rapport à un séparateur

Afin de découper une chaine de caractères en différentes chaînes (en une liste de chaines en réalité) par rapport à un séparateurAfin de remplacer une partie de chaine de caractères, il suffit d'utiliser l'instruction RECHSCINDER_REMPLACERCHAINE :

Bloc de code
/* ___ Déclarations _____________________________________________________________________
alpha(1000  50) myDays
alpha(1000) myDaysModified
alpha(  56) mySearchString
alpha(  78) myReplacementStringelementDay
liste       lst_days elementDay
alpha(1000) myDays

/* ___ Code _____________________________________________________________________________
myDays              = 'Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday' 
mySearchStringscinder_chaine    myDays  = ';'
myReplacementString lst_days  	
    /* la liste "lst_days" contiendra 7 éléments : 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'

4 - Remplacer une partie de chaine de caractères

Afin de remplacer une partie de chaine de caractères, il suffit d'utiliser l'instruction RECH_REMPLACER :

Bloc de code
/* ___ Déclarations _____________________________________________________________________
alpha(1000) myDays
alpha(1000) myDaysModified
alpha(  56) mySearchString
alpha(  78) myReplacementString

/* ___ Code _____________________________________________________________________________
myDays              = 'Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday'
mySearchString      = ';'
myReplacementString = ' = ' , '
myDaysModified      = *blank
rech_replacer myDays mySearchString myReplacementString myDaysModified
	/* la chaine myDaysModified contiendra 'Sunday , Monday , Tuesday , Wednesday , Thursday , Friday , Saturday'

...

5 - Ajouter un "retour chariot" dans une chaine de manière à avoir un retour à la ligne dans un champs d'un écran.

Afin d'ajouter un "retour" à une variable alphanumerique, il faudra créer une chaine alpha contenant le caractère "CR" (carriage return) et le caractère "LF" (line feed).

...

Quand un index n'a plus d'utiliité dans le programme, on peut le détruire it (pour libérer de la mémoire) avec l'instruction DELETE_INDEX.

4 - Operations on lists

Pour vider une liste , on utilisera l'instruction L4G VIDER_LST,

Pour copier une liste dans une autre liste, on utilisera l'instruction L4G COPIER_LST,

Pour inserer une liste dans une autre liste, on utilisera l'instruction L4G INSERER_LST

Pour trier une liste , on utilisera l'instruction L4G SORT_LST.To delete a list , we can use the CLEAR_LST instruction,To copy a list to another list, we can use the COPY_LST instruction,To insert a list in another list, we can use the INSERT_LST instruction, To sort a list , we can use the SORT_LST instruction

Bloc de code
/* ___ Utlisation Listsde usagelistes _______________________________________________________________
CLEAR
VIDER_LST   LST_EXAMPLE								/* clearefface the list specified
COPYla liste,
COPIER_LST  LST_ONE LST_TWO   						/* copycopier thele contentcontenu ofde thela listliste LST_ONE indans thela listliste LST_TWO, 
													/* the two lists are identical at the end of the instruction, 
													/* the two lists must have the same structure,
INSERTINSERER_LST LST_ONE LST_TWO							/* addajoute thele contentcontenu ofde thela firstpremière listliste toà thela secondseconde listliste,
													/* by default the elements are added at the end, but we can specify *BEGIN, *END, *BEFORE, *AFTER
INSERTpar défaut les élémnts sont ajoutés à la fin de la liste de destination, mais on peut spécifier *DEBUUT, *FUN, *AVANT, *APRES
INSERER_LST LST_ONE LST_TWO *BEGINDEBUT					/* addajoute thele contentcontenu ofde thela firstpremière listliste atau thedébut startde ofla the second list 
INSERTseconde liste
INSERER_LST LST_ONE LST_TWO *ENDFIN			      		/* addajoute thele contentcontenu ofde thela firstpremière listliste atà thela endfin ofde thela secondseconde list liste
INSERTINSERER_LST LST_ONE LST_TWO *BEFOREAVANT					/* addajoute thele contentcontenu ofde thela firstpremière listliste justavant beforel'élément thecourant currentde elementla ofseconde theliste second list 
INSERTINSERER_LST LST_ONE LST_TWO *AFTERAPRES					/* add the content of the first list just before the current element of the second list 

SORT_LSTajoute le contenu de la première liste avant l'élément courant de la seconde liste 

TRIER_LST   LST_EXAMPLE ELT_2205 *DESC, ELT_ONE		/* trier sortla theliste listsur onla thecolonne ELT_2205 columen inordre descendingdécroissant orderet andsur thenla oncolonne ELT_ONE par columnordre ascendingcroissant


...

SQL

1 -

...

Valeurs nulles

Quand on lit des informations en provenance de la base de données, on doit parfois gérer des valeurs NULLES.

Par exemple si on veut gérer les valeurs MOYENNE (ou

...

When reading information from the database, we sometimes have to deal with NULL values.

For example if you want to search for the AVERAGE (or MIN, MAX etc) value of a column, sometimes your des colonnes, parfois le *COND(condition) will return no line or you have null values for the specified columns.

And sometime you have to know that there is no value.

ne retourne aucune ligne ou bien vous avez des valeurs nulles dans les colonnes spécifiées.

Et parfois il est important de savoir qu'il n'y a pas de valeur.

Pour faire celà, on utilisera des indicatoreursTo do this we have to use indicators.

Bloc de code
/* ___ Declarations _____________________________________________________________________
num_bin_2   wIndAverage
num_e( 8,2) wAverageValue
num_bin_2   wIndMax
num_e( 8,2) wMaxValue

/* ___ Code _____________________________________________________________________________
chainlire_sql employee *col(	averagemoyenne(age) 	:wAverageValue 	:wIndAverage, 	-
							max(age) 		:wMaxValue 		:wIndMax 		- 
				   *cond( name='milkwater')										/* searchrecherche de forla themoyenne averageet anddu max age of employees with name equals to des ages des employés dont le nom est égal à "milkwater" 
ifsi wIndAverage = -1 
	/* nopas de valuevaleur forpour thela averagemoyenne
elsesinon
	/* ...
endfin
ifsi wIndMax = -1 
	/* nopas de valuevaleur forpour thele maximum
elsesinon
	/* ...
endfin

2 - Locked records

One or several lines in a table can be locked. This is caused by a process which modified records in a table without committing the changes. The consequence is that no other process can modify the lines before the first commit or rollback was executed. Even a locked record can not be modified, it can be read by another database user.

...