如何使用DFSORT将IBM文件转换为十六进制? [英] How to convert IBM file to hexadecimal using DFSORT?
问题描述
使用此输入:
H800
会将此输出保存在一个文件中:
48383030
我试过这种方式:
// R45ORF80V JOB(EFAS,2SGJ000),'LLAMI',NOTIFY = R45ORF80,
// MSGLEVEL =(1,1),MSGCLASS = X,CLASS = A,
// REGION = 0M,TIME = 5
// * --------- ------------------------------------------
// SORTEST EXEC PGM = ICEMAN
// SORTIN DD DSN = LF58.DFE.V1408001,DISP = SHR
// SORTOUT DD DSN = LF58.DFE.V1408001.OUT,
// DISP =(NEW ,CATLG,DELETE),
// LRECL = 4,DATACLAS = CDMULTI
// SYSOUT DD SYSOUT = X
// SYSPRINT DD SYSOUT = X
// SYSUDUMP DD SYSOUT = X
// SYSIN DD *
SORT FIELDS = COPY
OUTREC FIELDS =(1,4,HEX)
END
/ *
$ c
C8F1F0F0
我做错了什么?
是否可以将带有500个LREC和COMP-3字段的文件转换为十六进制文件?
在使用文件管理器浏览文件时,我可以使用HEX命令。
您的控制卡为您提供您所要求的输出。它们向您显示EBCDIC中这些字符的十六进制值,而不是ASCII码,即您期望的十六进制值。
如果您确实想看到ASCII等效项,请使用TRAN = ETOA,然后TRAN = HEX。
您正在使用 OUTREC FIELDS
。 FIELDS
有一个新的同义词(从10年开始),即BUILD。向后兼容支持FIELDS。
INREC
和 OUTREC
是类似的, INREC
在 SORT
或 MERGE
, OUTREC
之后。
我建议,除非您需要在SORT / MERGE后执行此操作,使用 INREC
。
所以:
INREC BUILD =(1,4,TRAN = ETOA)
但,没有必要使用BUILD。 BUILD总是创建记录的新版本。很多时候,这是你在重新整理田地时想要的。
INREC OVERLAY =(1,4,TRAN = ETOA)
如果你用你的OUTREC替换,你的输出文件将被编码为ASCII。
如果您还想看到ASCII:
INREC OVERLAY =(1,4,TRAN = ETOA,1 ,4,TRAN = HEX)
如果您想查看ASCII代码:
INREC OVERLAY =(1,4,TRAN = ETOA,1:1,4,TRAN = HEX)
请注意上例中的 1:
。这表示结果将位于第1位,因此覆盖以前转换的数据。 OVERLAY
可以这样做, BUILD
不能在一个语句中。
I'm trying to pass a IBM file to hex values.
With this input:
H800
Would save this output in a file:
48383030
I tried by this way:
//R45ORF80V JOB (EFAS,2SGJ000),'LLAMI',NOTIFY=R45ORF80,
// MSGLEVEL=(1,1),MSGCLASS=X,CLASS=A,
// REGION=0M,TIME=5
//*---------------------------------------------------
//SORTEST EXEC PGM=ICEMAN
//SORTIN DD DSN=LF58.DFE.V1408001,DISP=SHR
//SORTOUT DD DSN=LF58.DFE.V1408001.OUT,
// DISP=(NEW,CATLG,DELETE),
// LRECL=4,DATACLAS=CDMULTI
//SYSOUT DD SYSOUT=X
//SYSPRINT DD SYSOUT=X
//SYSUDUMP DD SYSOUT=X
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,4,HEX)
END
/*
But it outputs the following:
C8F1F0F0
What am I doing wrong? Is posible to convert to hexadecimal a file with 500 of LREC with COMP-3 fields too? Just by the way I could use "HEX" command while I browse a file using file manager.
Your control cards are giving you the output you have asked for. They are showing you the hexadecimal values of those characters in EBCDIC, not in ASCII, the hexadecimal values you are expecting.
If you actually want to see the ASCII equivalent, use TRAN=ETOA, then TRAN=HEX.
You are using OUTREC FIELDS
. FIELDS
has a new synonym (from exactly 10 years) which is BUILD. FIELDS is supported for backwards compatibility.
INREC
and OUTREC
are similar, INREC
operates before a SORT
or MERGE
, OUTREC
afterwards.
What I recommend, unless you need to be doing it after a SORT/MERGE, is to use INREC
.
So:
INREC BUILD=(1,4,TRAN=ETOA)
But, there is no need to use BUILD. BUILD always creates a new version of the record. Many times this is what you want when you are rearranging fields. Here, you are not.
INREC OVERLAY=(1,4,TRAN=ETOA)
If you replace your OUTREC with that, your output file will be encoded in ASCII.
If you want to see the ASCII as well:
INREC OVERLAY=(1,4,TRAN=ETOA,1,4,TRAN=HEX)
If you want to see the ASCII instead:
INREC OVERLAY=(1,4,TRAN=ETOA,1:1,4,TRAN=HEX)
Note the 1:
in the last example. This says "the results are going to be at position 1", so overwriting your previous converted data. OVERLAY
can do that, BUILD
cannot in one statement.
这篇关于如何使用DFSORT将IBM文件转换为十六进制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!