Give me some ideas .. how to solve this problem
Posted: Mon Feb 06, 2012 10:20 pm
hi there. i need to write a cobol program to split file contains fix part & variable part. the length of file is 10k. 204byte is fix part the rest is var part. the contains of the file some sort like this
CICSJCMIC42DMQ11W6ph5Mm5Pz8GgiULbPgzG37mj9g= 101010180120802500120110805150736CMNOWC01ENF03001N101 ^^CMNOWC01~~CMNOW_REF_NO=1820101010101~CMNOW_CATEGORY=1~CMNOW_NEW_ID=820101010101~CMNOW_OLD_ID=A181814~CMNOW_POLICE_ID=X~CMNOW_ARMY_ID=X~CMNOW_PR_ID=X~CMNOW_CERT_ID=X~CMNOW_STATUS=0~CMNOW_NAME=RAZALIBINAHAMD~CMNOW_ADDRESS1=JALAN1~CMNOW_ADDRESS2=JALAN2~CMNOW_ADDRESS3=JALAN3~CMNOW_POSTCODE=40540~CMNOW_CITY_CODE=0101~CMNOW_STATE_CODE=01
Fix part & var part is separated with '~~'
Column Name & value of the column name is separated with '='. Ex CMNOW_NEW_ID=820101010101
Each Column Name & value separated with '~'. Ex CMNOW_NEW_ID=820101010101~CMNOW_OLD_ID=A181814
My task is, how to split the file into column name/value of the column. what is the best method to solve this?. Already try used UNSTRING but doesn't work because the total column/value is not fix. Maybe can contains 10/15/20 column/value.
Can somebody give me some ideas to solve this problems.
CICSJCMIC42DMQ11W6ph5Mm5Pz8GgiULbPgzG37mj9g= 101010180120802500120110805150736CMNOWC01ENF03001N101 ^^CMNOWC01~~CMNOW_REF_NO=1820101010101~CMNOW_CATEGORY=1~CMNOW_NEW_ID=820101010101~CMNOW_OLD_ID=A181814~CMNOW_POLICE_ID=X~CMNOW_ARMY_ID=X~CMNOW_PR_ID=X~CMNOW_CERT_ID=X~CMNOW_STATUS=0~CMNOW_NAME=RAZALIBINAHAMD~CMNOW_ADDRESS1=JALAN1~CMNOW_ADDRESS2=JALAN2~CMNOW_ADDRESS3=JALAN3~CMNOW_POSTCODE=40540~CMNOW_CITY_CODE=0101~CMNOW_STATE_CODE=01
Fix part & var part is separated with '~~'
Column Name & value of the column name is separated with '='. Ex CMNOW_NEW_ID=820101010101
Each Column Name & value separated with '~'. Ex CMNOW_NEW_ID=820101010101~CMNOW_OLD_ID=A181814
My task is, how to split the file into column name/value of the column. what is the best method to solve this?. Already try used UNSTRING but doesn't work because the total column/value is not fix. Maybe can contains 10/15/20 column/value.
Can somebody give me some ideas to solve this problems.