This simple routine receives a single field and returns a group representing the header record and a list containing child records.
Group_By Name(#GRP_Empl) Fields(#Empno #Surname #Givename #Address1 #Address2 #Address3 #Postcode #Phonehme #Phonebus #Deptment #Section #Salary #Startdte #Termdate)
Srvroutine Name(GetEmployee)
Field_Map For(*Input) Field(#Empno) Parameter_Name(ID)
Group_Map For(*output) Group(#GRP_Empl) Parameter_Name(Employee)
List_Map For(*output) List(#LstSkills) Parameter_Name(Skills)
Field_Map For(*output) Field(#io$sts) Parameter_Name(Status)
Fetch Fields(#Employee) From_File(pslmst) With_Key(#Empno)
If_Status is(*Okay)
Selectlist Named(#LstSkills) from_file(PSLSKL) With_key(#EMPNO)
Add_entry to_list(#LstSkills)
Endselect
Endif
Endroutine
Note the use of PARAMETER_NAME to present the maps as a more readable name. When the routine is executed, it may be coded as follows:
Define_Com Class(#Server.GetEmployee) Name(#GetEmployee)
#GetEmployee.ExecuteAsync ID(#Xxx) Employee(#Yyy) Skills(#Zzz)