-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetEmpDtl
More file actions
57 lines (55 loc) · 2.25 KB
/
getEmpDtl
File metadata and controls
57 lines (55 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('QC2LE':'YASH/YASHWANT')
FEMPL1 IF E K disk
D GetEnv pr * extproc('getenv')
D var * value Options(*string)
*
Dwritetoweb pr extproc('QtmhWrStout')
D datavar 65535A Options(*varsize)
D datavarlen 10I 0 const
D errorcode 8000A Options(*Varsize)
*
DErrds ds qualified
DBytesProv 10I 0 Inz(0)
DBytesAvail 10I 0 Inz(0)
*
DCRLF C x'0d25'
DDATA S 5000A
DURL S 1000A Inz
DPARM S 100A Inz
DPOS S 10I 0
DEmpp S Like(EMPID) Inz
*
C empkey klist
C kfld Empp
/Free
DATA = 'Content-type: Text/xml' + CRLF + CRLF ;
writetoweb(DATA: %len(%trim(DATA)): ErrDs);
URL = %Str( GetEnv('REQUEST_URI') );
PARM = '/getemp/';
POS = %Scan(%Trim(PARM):URL) + %len(%trim(PARM));
Monitor;
Empp = %int(%subst(URL:pos:3)) ;
On-Error;
DATA = '<Error> Invalid URI </Error>';
writetoweb(DATA: %len(%trim(DATA)): ErrDs);
Return;
EndMon;
DATA = '<Employeedetails>' + CRLF ;
writetoweb(DATA: %len(%trim(DATA)): ErrDs);
Chain empkey empl1;
If %found;
DATA = '<Employeeid>' + %char(EMPID) + '</Employeeid>' + CRLF +
'<Name>' + EMPNAME + '</Name>' + CRLF +
'<Mobno>' + %char(MOBNO) + '</Mobno>' + CRLF +
'<Department>' + DEPT + '</Department>' + CRLF +
'<Status>Success</Status>' + CRLF ;
writetoweb(DATA: %len(%trim(DATA)): ErrDs);
Else;
DATA = '<Status>Employee not found</Status>' + CRLF ;
writetoweb(DATA: %len(%trim(DATA)): ErrDs);
EndIf;
DATA = '</Employeedetails>' + CRLF ;
writetoweb(DATA: %len(%trim(DATA)): ErrDs);
*Inlr = *On;
Return;
/End-Free