|
View previous topic :: View next topic
|
| Author |
Message |
cvishu
Active User

Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
i have 2 files , on file has 200 bytes and the other file has 300 bytes
i want the out put tobe of first 200 bytes from file a and last 100 bytes from file b . Can we do it in sort ?
eg :
File 1
AAAAA
BBBBB
CCCCC
File 2
sssssdddddd
sssssffffffffff
gggggffffffff
out put :
AAAAAdddddd
BBBBBffffffffff
CCCCCffffffffff |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What is the RECFM and LRECL of input file1?
What is the RECFM and LRECL of input file2?
Do you want to go record by record (e.g. file1 record1 with file2 record1, file1 record2 with file2 record2, etc)? |
|
| Back to top |
|
 |
cvishu
Active User

Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
| Frank Yaeger wrote: |
What is the RECFM and LRECL of input file1?
What is the RECFM and LRECL of input file2?
Do you want to go record by record (e.g. file1 record1 with file2 record1, file1 record2 with file2 record2, etc)? |
record size lets say both are 500
yes iwant to go record by record... its a one tone mapping in the same order as they appear.. 1st vs 1st, 2nd vs 2nd so on |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
cvishu,
The following JCL will give you the desired results. Since both files are of the same lrecl and recfm, we concatenate them together along with a single line file which has "HDR" in the first 3 bytes.
Step0100 creates a 1 line file with hdr which will be used to differentiate as to which record the file came from
Step0200 merges the record by record and creates a single record
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(500:X)
OUTFIL REMOVECC,TRAILER1=(1:'HDR')
/*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your inp2 file picking last 100bytes,disp=shr
// DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your inp1 file picking first 200bytes,disp=shr
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(501:SEQ=8))
SORT FIELDS=(501,8,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(401:401,100))
OUTFIL NODETAIL,REMOVECC,OMIT=(501,8,ZD,EQ,1),BUILD=(300X),
SECTIONS=(501,8,TRAILER3=(1,200,401,100))
/* |
|
|
| Back to top |
|
 |
cvishu
Active User

Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
| hi thanks for the code.. is there any alternate command for "PUSH".. my compiler doesnt seem to support it |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| cvishu wrote: |
| my compiler doesnt seem to support it |
Why compiler comes here?
Actually you are using older release of DFSORT. |
|
| Back to top |
|
 |
cvishu
Active User

Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
| Sambhaji wrote: |
| cvishu wrote: |
| my compiler doesnt seem to support it |
Why compiler comes here?
Actually you are using older release of DFSORT. |
okie am sorry am no techie genious .. yes may be its a plder version not sure..could u suggest an alternative |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| PUSH requires z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Ask your System Programmer to install it (it's free). |
|
| Back to top |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
Bhargav,
I removed your non-DFSORT solution. This is the DFSORT Forum - please only post DFSORT solutions here.
Frank - The Moderator |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
cvishu,
The following DFSORT/ICETOOL JCL will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(500:X)
OUTFIL REMOVECC,TRAILER1=(1:'HDR')
//*
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your inp2 file picking last 100bytes,disp=shr
// DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your inp1 file picking first 200bytes,disp=shr
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(517,8,CH) WITH(1,400) USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(501:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'HDR'),OVERLAY=(501:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,OVERLAY=(509:SEQNUM,8,ZD,
501:501,8,ZD,SUB,509,8,ZD,M11,LENGTH=8,
517:SEQNUM,8,ZD,RESTART=(501,8)))
OUTFIL FNAMES=OUT,OMIT=(517,8,CH,EQ,C' '),BUILD=(1,200,401,100)
//* |
|
|
| Back to top |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
| Oops I am sorry frank! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|