Map 사용 예제
본 장에서는 OSC를 설치할 때 함께 설치되는 OIVP로 맵 사용에 대한 일련의 과정을 설명한다.
1. 개요
OIVP(OpenFrame Online Installation Verification Procedure)는 OpenFrame 환경이 올바르게 구축되어 시스템에서 제공하는 기능에 문제가 없는지 검증하기 위한 애플리케이션 프로그램이다.
다음은 OIVP로 맵을 사용하는 과정이다.
OIVP에 대한 자세한 설명은 OpenFrame OSC "운영자 안내서"를 참고한다. |
2. Map과 애플리케이션의 소스 코드 작성
먼저 맵 소스 코드와 맵을 사용하는 애플리케이션 소스 코드의 작성이 필요하다.
다음은 OIVP의 메인 프로그램인 OIVPMAIN의 COBOL 소스 코드이다.
ID DIVISION. PROGRAM-ID. OIVPMAIN. AUTHOR. BSKIM. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-TRANS-ID PIC X(4) VALUE 'OIVP'. 01 WS-MAPSET-NAME PIC X(7) VALUE 'OIVPMS1'. 01 WS-MAP-NAME PIC X(7) VALUE 'OIVPM01'. 01 WS-RESPONSE-CODE PIC S9(8) COMP. 01 WS-COMMUNICATION-AREA PIC X(1). 01 WS-FIRST-TIME-FLAG PIC S9(4) COMP. 88 FIRST-TIME VALUE 0. 01 WS-ERROR-MESSAGE. 05 PIC X(35) VALUE '** OSC ERROR -- CONTACT HELP DESK '. 05 PIC X(35) VALUE '-- REPORT THIS INFORMATION ** '. 05 PIC X(9) VALUE SPACE. 05 WS-ERROR-LINE1. 10 PIC X(14) VALUE ' EIBTRNID = '. 10 WS-EIBTRNID PIC X(4). 10 PIC X(61) VALUE SPACES. 05 WS-ERROR-LINE2. 10 PIC X(14) VALUE ' EIBRSRCE = '. 10 WS-EIBRSRCE PIC X(8). 10 PIC X(57) VALUE SPACES. 05 WS-ERROR-LINE3. 10 PIC X(14) VALUE ' EIBRESP = '. 10 WS-EIBRESP PIC ZZZZZZZ9. 10 PIC X(57) VALUE SPACES. 05 WS-ERROR-LINE4. 10 PIC X(14) VALUE ' EIBRESP2 = '. 10 WS-EIBRESP2 PIC ZZZZZZZ9. 10 PIC X(57) VALUE SPACES. 05 PIC X(79) VALUE ALL '*'. COPY OIVPM01. 01 DEFINITIONS-OF-EIBAID-FIELD PIC X(1). 88 ENTER-KEY VALUE ''''. 88 CLEAR-KEY VALUE '_'. 88 PF1-KEY VALUE '1'. 88 PF2-KEY VALUE '2'. 88 PF3-KEY VALUE '3'. 88 PF4-KEY VALUE '4'. 88 PF5-KEY VALUE '5'. 88 PF6-KEY VALUE '6'. 88 PF7-KEY VALUE '7'. 88 PF8-KEY VALUE '8'. 88 PF9-KEY VALUE '9'. 88 PF10-KEY VALUE ':'. 88 PF11-KEY VALUE '#'. 88 PF12-KEY VALUE '@'. * DEFINITION OF INFORMATION 01 WS-DATE-TIME-AREA. 05 DCA-DATE PIC X(8). 05 DCA-TERM PIC X(4). 05 DCA-TIME. 10 DCA-TIME-HRS PIC z9. 10 DCA-COLON PIC X(1). 10 DCA-TIME-MIN PIC 9(2). 10 DCA-TIME-AMPM PIC X(3). * DEFINITION OF RESOURCES 01 FILE01 PIC X(8) VALUE 'OIVPFILE'. 01 TDQ01 PIC X(8) VALUE 'OIV1'. 01 TSQ01 PIC X(8) VALUE 'OIVPTSQ'. 01 ITEM01 PIC S9(4) COMP VALUE 1. 01 LEN PIC S9(4) COMP VALUE 4. 01 LEN1 PIC S9(4) COMP VALUE 8. 01 START-KEY PIC S9(8) COMP VALUE 0. * DEFINITION OF PEOPLE 01 DATALEN PIC S9(4) COMP VALUE 104. 01 PEOPLE-INFO-GET. 02 WS-KEY PIC S9(8) COMP. 02 WS-DATA. 05 WS-NAME PIC X(10). 05 WS-DEPARTMENT PIC X(15). 05 WS-PHONE PIC X(15). 05 WS-EMAIL PIC X(20). 05 WS-ADDRESS PIC X(40). LINKAGE SECTION. 01 DFHCOMMAREA PIC X(1). PROCEDURE DIVISION. 0000-MAIN. PERFORM 5100-ALWAYS-TEST. EVALUATE TRUE WHEN FIRST-TIME PERFORM 0100-FIRST-TIME WHEN ENTER-KEY PERFORM 0200-MENU WHEN OTHER PERFORM 9100-INVALID-KEY END-EVALUATE. PERFORM 5300-RETURN-TRANS-ID. 0100-FIRST-TIME. MOVE LOW-VALUES TO OIVPM01O. MOVE 'ENTER APPROPRIATE CODE OR ID' TO MSGO. PERFORM 5200-INFO. PERFORM 7200-SENDMAP. 0200-MENU. PERFORM 7100-RECEIVEMAP. EVALUATE CODEI WHEN 'BROS' PERFORM 0300-BROWSE WHEN 'INQR' PERFORM 0400-INQUIRY WHEN 'INSR' PERFORM 0500-INSERT WHEN 'UPDT' PERFORM 0600-UPDATE WHEN 'DELT' PERFORM 0700-DELETE WHEN OTHER PERFORM 9200-INVALID-CODE END-EVALUATE. 0300-BROWSE. EXEC CICS STARTBR FILE(FILE01) RIDFLD(START-KEY) KEYLENGTH(LEN) RESP(WS-RESPONSE-CODE) END-EXEC. IF WS-RESPONSE-CODE NOT EQUAL DFHRESP(NORMAL) MOVE 'DATA DOES NOT EXIST' TO MSGO PERFORM 7250-SENDMAP-DATA PERFORM 5300-RETURN-TRANS-ID END-IF. EXEC CICS START TRANSID('OIBR') TERMID(EIBTRMID) RESP(WS-RESPONSE-CODE) END-EXEC. PERFORM 5300-RETURN-TRANS-ID. 0400-INQUIRY. MOVE IDENI TO WS-KEY. PERFORM 0800-CHECK-DATA. EXEC CICS ENQ RESOURCE('OIVPTDQW') LENGTH(8) END-EXEC. EXEC CICS WRITEQ TD QUEUE(TDQ01) FROM(PEOPLE-INFO-GET) LENGTH(DATALEN) END-EXEC. EXEC CICS DEQ RESOURCE('OIVPTDQW') LENGTH(8) END-EXEC. EXEC CICS START TRANSID('OIIQ') TERMID(EIBTRMID) RESP(WS-RESPONSE-CODE) END-EXEC PERFORM 5300-RETURN-TRANS-ID. 0500-INSERT. EXEC CICS START TRANSID('OIIS') TERMID(EIBTRMID) RESP(WS-RESPONSE-CODE) END-EXEC PERFORM 5300-RETURN-TRANS-ID. 0600-UPDATE. MOVE IDENI TO WS-KEY. PERFORM 0800-CHECK-DATA. EXEC CICS WRITEQ TS QUEUE(TSQ01) FROM(WS-KEY) LENGTH(LEN1) ITEM(ITEM01) END-EXEC. EXEC CICS START TRANSID('OIUP') TERMID(EIBTRMID) RESP(WS-RESPONSE-CODE) END-EXEC. PERFORM 5300-RETURN-TRANS-ID. 0700-DELETE. MOVE IDENI TO WS-KEY. PERFORM 0800-CHECK-DATA. EXEC CICS WRITEQ TS QUEUE(TSQ01) FROM(WS-KEY) LENGTH(LEN1) ITEM(ITEM01) END-EXEC. EXEC CICS START TRANSID('OIDE') TERMID(EIBTRMID) RESP(WS-RESPONSE-CODE) END-EXEC. PERFORM 5300-RETURN-TRANS-ID. 0800-CHECK-DATA. EXEC CICS READ FILE(FILE01) RIDFLD(WS-KEY) KEYLENGTH(LEN) INTO(PEOPLE-INFO-GET) LENGTH(DATALEN) RESP(WS-RESPONSE-CODE) END-EXEC. EVALUATE WS-RESPONSE-CODE WHEN DFHRESP(NORMAL) CONTINUE WHEN DFHRESP(NOTFND) MOVE LOW-VALUES TO OIVPM01O MOVE 'ID ERROR' TO MSGO PERFORM 7200-SENDMAP PERFORM 5300-RETURN-TRANS-ID END-EVALUATE. 5100-ALWAYS-TEST. MOVE EIBAID TO DEFINITIONS-OF-EIBAID-FIELD. IF CLEAR-KEY PERFORM 5400-QUIT. MOVE EIBCALEN TO WS-FIRST-TIME-FLAG. 5200-INFO. EXEC CICS LINK PROGRAM ('OIVPINFO') COMMAREA (WS-DATE-TIME-AREA) LENGTH (LENGTH OF WS-DATE-TIME-AREA) END-EXEC. MOVE DCA-DATE TO DATEO. MOVE DCA-TERM TO TERMO. MOVE DCA-TIME TO TIMEO. 5300-RETURN-TRANS-ID. EXEC CICS RETURN TRANSID (WS-TRANS-ID) COMMAREA (WS-COMMUNICATION-AREA) LENGTH (LENGTH OF WS-COMMUNICATION-AREA) END-EXEC. 5400-QUIT. EXEC CICS START TRANSID('OIQU') AFTER SECONDS(5) TERMID(EIBTRMID) RESP(WS-RESPONSE-CODE) END-EXEC. EXEC CICS RETURN END-EXEC. * PERFORM 5300-RETURN-TRANS-ID. 7100-RECEIVEMAP. EXEC CICS RECEIVE MAP(WS-MAP-NAME) MAPSET(WS-MAPSET-NAME) INTO(OIVPM01I) RESP(WS-RESPONSE-CODE) END-EXEC. EVALUATE WS-RESPONSE-CODE WHEN DFHRESP(NORMAL) CONTINUE WHEN DFHRESP(MAPFAIL) MOVE 'NO CODE OR ID ENTERED' TO MSGO PERFORM 7250-SENDMAP-DATA PERFORM 5300-RETURN-TRANS-ID WHEN OTHER PERFORM 9999-ABORT END-EVALUATE. 7200-SENDMAP. EXEC CICS SEND MAP(WS-MAP-NAME) MAPSET(WS-MAPSET-NAME) FROM(OIVPM01O) ERASE CURSOR END-EXEC. 7250-SENDMAP-DATA. EXEC CICS SEND MAP(WS-MAP-NAME) MAPSET(WS-MAPSET-NAME) FROM(OIVPM01O) DATAONLY END-EXEC. 9100-INVALID-KEY. MOVE LOW-VALUES TO OIVPM01O. MOVE 'INVALID KEY ENTERED' TO MSGO. PERFORM 7250-SENDMAP-DATA. 9200-INVALID-CODE. MOVE LOW-VALUES TO OIVPM01O. MOVE 'INVALID CODE ENTERED' TO MSGO. PERFORM 7250-SENDMAP-DATA. 9999-ABORT. MOVE EIBTRNID TO WS-EIBTRNID. MOVE EIBRSRCE TO WS-EIBRSRCE. MOVE EIBRESP TO WS-EIBRESP. MOVE EIBRESP2 TO WS-EIBRESP2. EXEC CICS SEND TEXT FROM(WS-ERROR-MESSAGE) ERASE ALARM FREEKB END-EXEC. EXEC CICS RETURN END-EXEC.
다음은 OIVP에서 사용하는 맵 소스 코드인 OIVPM001의 예제이다.
OIVPMS1 DFHMSD TYPE=&SYSPARM, X LANG=COBOL, X MODE=INOUT, X CTRL=FREEKB, X STORAGE=AUTO, X TIOAPFX=YES OIVPM01 DFHMDI SIZE=(24,80), X LINE=1, X COLUMN=1 DATE DFHMDF POS=(1,2), X LENGTH=8, X ATTRB=(NORM,PROT,FSET) TERM DFHMDF POS=(1,74), X LENGTH=4, X ATTRB=(NORM,PROT,FSET) TIME DFHMDF POS=(2,2), X LENGTH=8, X ATTRB=(NORM,PROT,FSET) DFHMDF POS=(1,24), X LENGTH=33, X ATTRB=(NORM,PROT), X HILIGHT=BLINK, X INITIAL='** WELCOME TO OPENFRAME ONLINE **' DFHMDF POS=(3,2), X LENGTH=77, X ATTRB=(NORM,PROT), X OUTLINE=OVER DFHMDF POS=(3,80), X LENGTH=1, X ATTRB=(DRK,PROT) DFHMDF POS=(4,17), X LENGTH=46, X ATTRB=(NORM,PROT), X COLOR=RED, X INITIAL='** OSC INSTALLATION VERIFICATION PROCEDURE **' DFHMDF POS=(7,23), X LENGTH=5, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='CODE ' CODE DFHMDF POS=(7,29), X LENGTH=4, X ATTRB=(NORM,UNPROT,IC), X COLOR=BLUE, X HILIGHT=REVERSE DFHMDF POS=(7,34), X LENGTH=1, X ATTRB=(DRK,PROT) DFHMDF POS=(7,43), X LENGTH=4, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='ID ' IDEN DFHMDF POS=(7,48), X LENGTH=8, X ATTRB=(NORM,UNPROT,NUM), X COLOR=BLUE, X HILIGHT=REVERSE DFHMDF POS=(7,57), X LENGTH=1, X ATTRB=(DRK,PROT) DFHMDF POS=(10,22), X LENGTH=36, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='BROS Browse data <BROS>' DFHMDF POS=(11,22), X LENGTH=36, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='INQR Inquiry data by ID <INQR,ID>' DFHMDF POS=(12,22), X LENGTH=36, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='INSR Insert data <INSR>' DFHMDF POS=(13,22), X LENGTH=36, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='UPDT Update data by ID <UPDT,ID>' DFHMDF POS=(14,22), X LENGTH=36, X ATTRB=(NORM,PROT), X COLOR=BLUE, X INITIAL='DELT Delete data by ID <DELT,ID>' MSG DFHMDF POS=(21,2), X LENGTH=76, X ATTRB=(BRT,PROT), X COLOR=YELLOW DFHMDF POS=(23,2), X LENGTH=77, X ATTRB=(NORM,PROT), X OUTLINE=OVER DFHMDF POS=(23,80), X LENGTH=1, X ATTRB=(DRK,PROT) DFHMDF POS=(24,29), X LENGTH=49, X ATTRB=(NORM,PROT), X INITIAL='CopyRight(c) 2007, Tmaxsoft, All Rights ReserveX d.' DFHMSD TYPE=FINAL END
3. Map 생성
다음 예제는 지정한 Region의 osc.{servername} 서브젝트, GENERAL 섹션의 MAPDIR 키의 VALUE 항목이 설정되지 않은 경우로 기본 디렉터리에 해당하는 $OPENFRAME_HOME/osc/region/OSCOIVP1/map 디렉터리를 사용한다. Map 소스 코드는 $OPENFRAME_HOME/osc/map 디렉터리에 있는 것으로 가정한다.
맵 소스 코드를 mscasmc 툴과 mscmapc 툴을 이용해서 아래와 같이 컴파일한다. 맵 파일의 배치 디렉터리를 준비한 후 [-r] 옵션을 사용하여 OSCOIVP1 Region의 지정된 위치에 자동으로 배치되도록 하는 OIVPM001.map을 컴파일한다.
$ cd $OPENFRAME_HOME/osc/region/OSCOIVP1/map
$ mkdir physical
$ mkdir symbolic
$ cd symbolic
$ mkdir OIVPMS1
$ cd $OPENFRAME_HOME/osc/map
$ mscasmc OIVPM001.map
[MSCASMC] input map : OIVPM001.map
[MSCASMC] file[OIVPM001.map.atm] create ok.
$ mscmapc -r OSCOIVP OIVPM001.map.atm
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* input map : OIVPM001.map.atm
* copybook :
[/home/oframe/OpenFrame/osc/region/OSCOIVP1/map/symbolic/OIVPMS1/OIVPMS1.cpy] create.
* binary image :
[/home/oframe/OpenFrame/osc/region/OSCOIVP1/map/physical/OIVPMS1.phy]
create.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$
4. 업무 컴파일
Map과 애플리케이션의 소스 코드 작성에서 작성된 OIVPMAIN 프로그램을 다음 예제와 같이 osccobprep, osccblpp 툴을 이용해서 전처리한 후 해당 COBOL 컴파일러를 이용해서 shared object 형태로 컴파일한다.
다음은 MF-COBOL을 사용해서 컴파일한 예제이다.
$ osccobprep –f .cpy –p
$ OPENFRAME_HOME/osc/region/OSCOIVP1/map/symbolic/OIVPMS1 OIVPMAIN.cob
$ osccblpp osccobprep_OIVPMAIN.cob
$ mv osccblpp_osccobprep_OIVPMAIN.cob OIVPMAIN.cbl
$ cob64 –zav –U –o OIVPMAIN.so OIVPMAIN.cbl
cob64 -C nolist -zav -U -o OIVPMAIN.so OIVPMAIN.cbl
* Micro Focus Server Express V4.0 revision 000 Compiler
* Copyright (C) 1984-2005 Micro Focus International Ltd. URN RXCAB/AA0/00000J
* Accepted - verbose
* Accepted - nolist
* Compiling OIVPMAIN.cbl
* Total Messages: 0
* Data: 7328 Code: 4825
* Micro Focus Server Express V4.0.00 Code generator
* Copyright (C) 1984-2005 Micro Focus International Ltd. All rights reserved.
* Accepted - verbose
* Generating osccblpp_osccobprep_OIVPMAIN
* Data: 7728 Code: 19664 Literals: 1472 Dynamic: 638976
Cobol program "cics_receive_map" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_writeq_td" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_writeq_ts" undefined. Assuming it will be dynamically loaded.
Cobol program "_Uia64_step" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_return" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_send_text" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_send_map" undefined. Assuming it will be dynamically loaded.
Cobol program "handle_exception" undefined. Assuming it will be dynamically loaded.
Cobol program "_Uia64_get_reg" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_startbr" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_entry" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_enq" undefined. Assuming it will be dynamically loaded.
Cobol program "_U_dyn_register" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_link" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_deq" undefined. Assuming it will be dynamically loaded.
Cobol program "_Uia64_init_local" undefined. Assuming it will be dynamically loaded.
Cobol program "_U_dyn_cancel" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_read" undefined. Assuming it will be dynamically loaded.
Cobol program "cics_start" undefined. Assuming it will be dynamically loaded.
Cobol program "_Uia64_getcontext" undefined. Assuming it will be dynamically loaded.
5. OSC SD 등록
맵 테스트를 위해서는 OSC 애플리케이션 서버에서 사용될 리소스 등록이 필요하다. 테스트를 위해 사용될 터미널을 정의하는 TERMINAL, 터미널 속성을 정의하는 TYPETERM, OIVP TRANSACTION과 위에서 작성한 OIVPMAIN PROGRAM 리소스가 등록되어야 한다.
다음은 OIVP 테스트를 위해서 정의되는 TERMINAL, TYPETERM, TRANSACTION, PROGRAM 정의의 예제이다.
DEFINE TERMINAL(TIVP) GROUP(OIVP) TYPETERM(TTRMOIVP) NETNAME(TERMOIVP) INSERVICE(YES) DEFINE TYPETERM(TTRMOIVP) GROUP(OIVP) AUDIBLEALARM(YES) COLOR(YES) HILIGHT(YES) IOAREALEN(512,4096) KATAKANA(YES) OUTLINE(YES) PROGSYMBOLS(YES) SOSI(YES) TERMMODEL(2) UCTRAN(NO) DEVICE(3270) USERAREALEN(128) LOGONMSG(NO) DEFINE PROGRAM(OIVPMAIN) GROUP(OIVP) LANGUAGE(COBOL) DEFINE TRANSACTION(OIVP) GROUP(OIVP) PROGRAM(OIVPMAIN) TWASIZE(255) RESSEC(YES) ADD GROUP(OIVP) LIST(OIVPLIST)
정의된 매크로는 oscsdgen을 이용해서 다음과 같이 시스템에 등록한다.
$ oscsdgen -r OSCOIVP1 oivp.dat
6. TN3270 에뮬레이터 설정
OSC 애플리케이션 서버에 접속하기 위해 터미널 에뮬레이터를 설정한다.
다음은 PCOM을 사용하여 서버에 접속하기 위한 설정의 예이다. PCOM은 IBM Personal Communication이라는 제품으로 OSC에서 지원하는 터미널 에뮬레이터 중 하나이다.
-
[PCOM] 메뉴에서 [통신] > [구성]을 선택한다. Customize Communication 대화상자가 나타나면 [Link Parameters…] 버튼을 클릭한다.
에뮬레이터 접속 설정 (1) -
Telnet3270 설정 화면이 나타나면 'Host Name or IP Address', 'LU or Pool Name', 'Port Number'를 입력하고 [OK] 버튼을 클릭한다.
다음은 접속하려는 게이트웨이 주소는 192.168.14.88, 포트 번호는 14100번인 경우의 예제 화면이다.
에뮬레이터 접속 설정 (2)
7. 테스트 화면 확인
TN3270 에뮬레이터를 사용해서 작성한 맵을 화면으로 확인해 본다.
-
서버에 접속해서 시작 화면이 나타나면 에뮬레이터의 키보드 설정에서 <Clear> 키로 지정된 키(기본값 <Break> 키)를 누른다.
OSC 서버 시작 화면 -
빈 화면이 나타나면 OSC SD 등록에서 등록한 OIVP 트랜잭션 이름을 입력한다.
OIVP 트랜잭션 입력 화면 -
Map과 애플리케이션의 소스 코드 작성에서 작성한 맵이 화면에 표시된다.
테스트 화면 표시