View previous topic :: View next topic
Author
Message
mpawankumar New User Joined: 26 Sep 2007Posts: 7 Location: Chennai
Hi,
Can any one help me out in joining the two files to prepare a dynamic cntl card?
File 1 - will have 2 rows.
Row1 sort fields=copy
Row2 Include condition
I need to get the date from file 2 and place that in 27th position of the 2nd row in file1 as shown below.
File1:
SORT FIELDS=COPY
INCLUDE COND=(39,4,PD,GE,<date from file2> ,AND,43,4,PD,GT,<time from file2> )
File2:
will have the date in CYYMMDD format and time in HHMMSS.
Output should be like below:
SORT FIELDS=COPY
INCLUDE COND=(39,4,PD,GE,1081212 ,AND,43,4,PD,GT,123333 )
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Same homework assignment. . .?
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
And I received the same question in a private message. Here's the response I gave:
You can use a DFSORT job like the following to do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
date (1081211) - CYYMMDD time (072412) HH-MM-SS
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(C'Tdate,''',7,7,C'''',80:X,/,
C'Ttime,''',44,6,C'''')
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *
SORT FIELDS=(51,11,CH,A)
INCLUDE COND=(39,4,PD,GE, ,AND,43,4,PD,GT, ,
AND,438,3,CH,EQ,C'146',AND,717,9,CH,NE,C' ')
/*
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(2,7,CH,EQ,C'INCLUDE'),
OVERLAY=(27:Tdate,50:Ttime))
/*
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Frank,
AFAIK, Here the first step produces Symbols like this,
Code:
Tdate,'cyymmdd'
Ttime,'hhmmss'
Since the final comparison is done against a numeric PD field, wont this quotes around the date and time values be a problem? Should n't this be something like this?
Code:
Tdate,+cyymmdd
Ttime,+hhmmss
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
No, it works fine as coded. I used:
Code:
OVERLAY=(27:Tdate,50:Ttime))
This overlays the blanks in the INCLUDE statement with the character constants - it does not use the symbols to do the compare.
If you run the job, you'll see that the resulting statements are:
Code:
SORT FIELDS=(51,11,CH,A)
INCLUDE COND=(39,4,PD,GE,1081211,AND,43,4,PD,GT,072412,
AND,438,3,CH,EQ,C'146',AND,717,9,CH,NE,C' ')
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Frank,
I got it. I was just comparing this with my solution. Did not notice that you were not doing the comparison. Thank you
Back to top
Please enable JavaScript!