View previous topic :: View next topic
|
Author |
Message |
bonda0123
New User
Joined: 07 Sep 2007 Posts: 9 Location: Hyderabad
|
|
|
|
I need a help for the conversion from EBCDIC to ASCII. Can anyone help me with the JCL utility or the JCL which helps us in this conversion. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Are you working between platforms (i.e mainframe and win-based/unix)?
Nearly always ascii/ebcdic translation is done as part of a file transfer.
If you explain more about what you need to do, we may have better suggestions. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
EBCDIC to ASCII. Three methods that I know of:
Code: |
//STEPXXX EXEC PGM=IKJEFT01
//SYSTERM DD DUMMY
//INPUT DD DSN=FB.dataset.EBC,DISP=SHR
//OUTPUT DD DSN=FB.dataset.ASC,
// DISP=(,CATLG,DELETE),...
//SYSTSIN DD DATA
OCOPY INDD(input) OUTDD(output) TEXT CONVERT((BPXFX311)) FROM1047
/*
|
Code: |
//STEPXXX EXEC SAS
//INPUT DD DSN=FB.dataset.EBC,DISP=SHR
//OUTPUT DD DSN=FB.dataset.ASC,
// DISP=(,CATLG,DELETE),...
//SYSIN DD *
DATA _NULL_;
INFILE INPUT;
FILE OUTPUT;
INPUT @1 LINE1 $CHAR80.;
PUT @1 LINE1 $ASCII80.;
/*
|
Code: |
/* REXX E2A */
/* INPUT VARIABLES: */
/* DLM = ASCII RECORD DELIMITER. NO DEFAULT. NORMALLY SET TO */
/* CRLF (CARRIAGE RETURN/LINE FEED) FOR WINDOWS, OR */
/* LF (LINE FEED ONLY) FOR UNIX SYSTEMS. */
/* TERM = ASCII END-OF-FILE TERMINATOR. NO DEFAULT. NORMALLY SET TO */
/* CZ (CONTROL-Z) FOR DOS OR WINDOWS. */
/* ***************************************************************** */
/* INPUT FILES: */
/* SYSUT1 = INPUT EBCDIC DATASET TO BE CONVERTED. MAY BE EITHER */
/* FB OR VB. */
/* SYSUT2 = OUTPUT ASCII DATASET. RECOMMENDED TO BE VB. */
/* ***************************************************************** */
PARSE UPPER ARG DLM TERM .
SELECT
WHEN DLM = "CR" THEN REC_DLM = '0D'X
WHEN DLM = "LF" THEN REC_DLM = '0A'X
WHEN DLM = "CRLF" THEN REC_DLM = '0D0A'X
WHEN DLM = "LFCR" THEN REC_DLM = '0A0D'X
OTHERWISE REC_DLM = ""
END
SELECT
WHEN TERM = "CZ" THEN REC_TERM = '1A'X
OTHERWISE REC_TERM = ""
END
DO FOREVER
"EXECIO 1 DISKR SYSUT1"
IF RC <> 0 THEN LEAVE
PARSE PULL EBC_REC
ASC_REC = ""
DO LOOP = 1 TO LENGTH(STRIP(EBC_REC,T," "))
CHR = SUBSTR(EBC_REC,LOOP,1)
CHR = E2A(CHR)
ASC_REC = ASC_REC||CHR
END
ASC_REC = ASC_REC||REC_DLM
PUSH ASC_REC
"EXECIO 1 DISKW SYSUT2"
END
IF LENGTH(REC_TERM) > 0 THEN
DO
PUSH REC_TERM
"EXECIO 1 DISKW SYSUT2"
END
"EXECIO 0 DISKR SYSUT1 (FINIS"
"EXECIO 0 DISKW SYSUT2 (FINIS"
EXIT 0
E2A:
RETURN TRANSLATE(ARG(1), ,
'00 01 02 03 9C 09 86 7F 97 8D 8E 0B 0C 0D 0E 0F'X||,
'10 11 12 13 9D 85 08 87 18 19 92 8F 1C 1D 1E 1F'X||,
'80 81 82 83 84 0A 17 1B 88 89 8A 8B 8C 05 06 07'X||,
'90 91 16 93 94 95 96 04 98 99 9A 9B 14 15 9E 1A'X||,
'20 A0 A1 A2 A3 A4 A5 A6 A7 A8 5B 2E 3C 28 2B 21'X||,
'26 A9 AA AB AC AD AE AF B0 B1 5D 24 2A 29 3B 5E'X||,
'2D 2F B2 B3 B4 B5 B6 B7 B8 B9 7C 2C 25 5F 3E 3F'X||,
'BA BB BC BD BE BF C0 C1 C2 60 3A 23 40 27 3D 22'X||,
'C3 61 62 63 64 65 66 67 68 69 C4 C5 C6 C7 C8 C9'X||,
'CA 6A 6B 6C 6D 6E 6F 70 71 72 CB CC CD CE CF D0'X||,
'D1 7E 73 74 75 76 77 78 79 7A D2 D3 D4 D5 D6 D7'X||,
'D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7'X||,
'7B 41 42 43 44 45 46 47 48 49 E8 E9 EA EB EC ED'X||,
'7D 4A 4B 4C 4D 4E 4F 50 51 52 EE EF F0 F1 F2 F3'X||,
'5C 9F 53 54 55 56 57 58 59 5A F4 F5 F6 F7 F8 F9'X||,
'30 31 32 33 34 35 36 37 38 39 FA FB FC FD FE FF'X)
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
bonda0123
New User
Joined: 07 Sep 2007 Posts: 9 Location: Hyderabad
|
|
|
|
Hi Dick scherrer and superk, Thanks a Lot for the immediate response.
I got a cobol code for doing this transaction :
COBOL CODE :
Code: |
Code removed due to copyright |
And the JCL to be run with the code will be :
JCL
Thanks a Lot once again to both of you for the immediate response.
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome
After the conversion, how will the ascii file be used on the mainframe? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
It has been brought to my attention that the code you posted is copyright material. Removing the copyright notice does not remove the copyright.
Do not post anything that is copyright in the forums.
I have removed the code. |
|
Back to top |
|
|
bonda0123
New User
Joined: 07 Sep 2007 Posts: 9 Location: Hyderabad
|
|
|
|
Thanks a Lot for letting me know this Scherer...yes as you said that is a copyright material got from some website search....But can you please let me know the way we can find out whether its a copyright material or not..So that I will take decision in future...
Thanks a Lot again for letting me know this!!! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
Back to top |
|
|
bonda0123
New User
Joined: 07 Sep 2007 Posts: 9 Location: Hyderabad
|
|
|
|
Sorry was away from my laptop from past few dayz. i will check those documents and will let you know if I have any clarifications.
Thanks a Lot Enrico once again for giving me this further info..!!! |
|
Back to top |
|
|
|