Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Dec 01, 2005 9:52 am Post subject: Convert low-values to spaces and vice-versa |
|
|
Is it possible to convert an EBCDIC character to another EBCDIC character Using SORT ?
The answer is Yes. The simplest way is to use DFSORT's TRAN=ALTSEQ operand with the ALTSEQ statement. (If you are using Syncsort then you need to have the latest version that supports the TRAN=ALTSEQ feature.)
Case 1: Convert All Low-values to Spaces
Sort Solution
Code: |
//R010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(0040)
OUTREC FIELDS=(1,LRECL,TRAN=ALTSEQ)
/*
|
Fileaid Solution:
Code: |
//STEP0100 EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=YOUR INPUT DATASET,
// DISP=SHR
//DD01O DD DSN=OUTPUT DATASET,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE),
// DCB=(RECFM=FB,LRECL=ZZZ,BLKSIZE=0)
//SYSIN DD *
$$DD01 COPY REPLALL=(1,0,X'00',X'40')
/*
|
Case 2: Convert Spaces to Low-values - You just have to change the Hex Character order in ALTSEQ code.
Sort Solution
Code: |
//R010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(4000)
OUTREC FIELDS=(1,LRECL,TRAN=ALTSEQ)
/*
|
Fileaid Solution:
Code: |
//STEP0100 EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=YOUR INPUT DATASET,
// DISP=SHR
//DD01O DD DSN=OUTPUT DATASET,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE),
// DCB=(RECFM=FB,LRECL=ZZZ,BLKSIZE=0)
//SYSIN DD *
$$DD01 COPY REPLALL=(1,0,X'40',X'00')
/*
|
Without Using ALTSEQ
There is another way to accomplish this without using ALTSEQ - which uses CHANGE operator of SORT. But coding the control card for this is a bit tedious.
Check this link for example: http://www.mvsforums.com/helpboards/viewtopic.php?p=6728#6728
Related Links:
http://www.mvsforums.com/helpboards/viewtopic.php?p=1454#1454
http://www.mvsforums.com/helpboards/viewtopic.php?p=16108#16108
http://www.mvsforums.com/helpboards/viewtopic.php?t=4932&highlight=altseq
Thanks,
Phantom |
|