IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Modify Out file with specific fields from Infile


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jpreethi

New User


Joined: 31 Oct 2006
Posts: 10

PostPosted: Tue Oct 31, 2006 12:18 am
Reply with quote

Hi,

Is it possible to have fields from OUTPUT file to remain while we OUTREC the required portion, in SORT/ICETOOL?

My requirement: OUTfile exists. Need to copy a date field from header of INfile (position 11) into 45th position (8th record) of output file.

Input File: Uniquely identifiable header record, Date: position 11
Output file: Need to modify 8th record alone, position 45 with date from input file.

All other records in output file to remain.

Can I use DFSORT/ICETOOL?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 31, 2006 12:39 am
Reply with quote

Well, what you're calling the "output file" is really an input file that you're going to modify for output, but yes you can do it with DFSORT.

What is the RECFM and LRECL of the file containing the date?
What is the RECFM and LRECL of the file containing the record to be modified?

What is the length of the date field?

Is the date field the only record in file containing the date? If not, what identifies the record with the date field (e.g. first record, or record with 'HDR' in positions 1-3).

Is the record to be modified only identified by the fact that it's the 8th record or is there something else in that record that could be used to identify it uniquely (e.g. 'ABC' in positions 1-3).

It would help if you showed an example of the records in each file and what you want for output.
Back to top
View user's profile Send private message
jpreethi

New User


Joined: 31 Oct 2006
Posts: 10

PostPosted: Tue Oct 31, 2006 12:45 am
Reply with quote

File with Date: SORTIN
SORTIN : RECFM=FB ; LRECL= 335
SORTOUT : RECFM=FB ; LRECL= 80

SORT FIELDS=COPY
INCLUDE COND=(11,8,CH,EQ,C'HRDRKPNS')
OUTFIL OUTREC=(45:19,08),
STARTREC=8,ENDREC=8

Input file: Record 1, Position: 11 Length of date: 8
Output file: Record 8, Position 45

Thanks for the quick response.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 31, 2006 1:38 am
Reply with quote

Not sure what all that is supposed to tell me. I think you're saying that the RECFM and LRECL of the file with the date is FB/335 and the RECFM and LRECL of the file to be modified is FB/80. And the length of the date field is 8.

But it isn't clear what your answers are to my other two questions:

Quote:
Is the date field the only record in file containing the date? If not, what identifies the record with the date field (e.g. first record, or record with 'HDR' in positions 1-3).

Is the record to be modified only identified by the fact that it's the 8th record or is there something else in that record that could be used to identify it uniquely (e.g. 'ABC' in positions 1-3).


Please answer these questions more directly. I don't have time for guessing games.

You show:

Code:

   INCLUDE COND=(11,8,CH,EQ,C'HRDRKPNS')


Is that how you identify the record to be modified, or what? Please be clear.

Again, It would help if you showed an example of the records (relevant fields only) in each file and what you want for output.
Back to top
View user's profile Send private message
jpreethi

New User


Joined: 31 Oct 2006
Posts: 10

PostPosted: Tue Oct 31, 2006 2:02 am
Reply with quote

File 1;
0000000000HRDRKPNS20061028
9099329233000000H151E1 FON1945041520000000
6194249076000000H202E RMS1991021220000000
9098228249000000H151E1 FON1950091820000000
9516586382000000H501E1 RIV1929092920000000

File2:
10.999.99.99
XXXXX
ASCII
PUT 'XXX.XX.XXXXX.OUTBOUND(+0)' 20061030_RMS_PAS_OUTBOU
CLOSE
QUIT

No key in either file.

Output:

10.999.99.99
XXXXX
ASCII
PUT 'XXX.XX.XXXXX.OUTBOUND(+0)' 20061028_RMS_PAS_OUTBOU
CLOSE
QUIT

Is the date field the only record in file containing the date? If not, what identifies the record with the date field (e.g. first record, or record with 'HDR' in positions 1-3). == > NO, Identified by "HRDR" in 11 position.
File 1: RECFM = Fixed Block, Length = 335.

Is the record to be modified only identified by the fact that it's the 8th record or is there something else in that record that could be used to identify it uniquely (e.g. 'ABC' in positions 1-3).
==> NO, Identified by "PUT" in positions 1-3 or simply 8th record.
File 2: RECFM = Fixed Block, Length = 80.

Length of date: 8
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 31, 2006 2:31 am
Reply with quote

Here's a DFSORT job that will do what I think you're asking for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/335)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY,STOPAFT=1
  INCLUDE COND=(11,4,CH,EQ,C'HRDR')
  OUTREC BUILD=(C'Mydate,''',19,8,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2 (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'PUT'),
    OVERLAY=(45:Mydate))
/*
Back to top
View user's profile Send private message
jpreethi

New User


Joined: 31 Oct 2006
Posts: 10

PostPosted: Tue Oct 31, 2006 4:52 am
Reply with quote

Thanks a bunch. But we use SYNCSORT FOR Z/OS 1.2.0.1R and BUILD gives a SYNTAX error.

I was thinking of using SPLICE.
//*
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//*
//IN1 DD DSN=file 1,DISP=SHR
//IN2 DD DSN=file 2,DISP=SHR
//T1 DD DSN=&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
// DISP=(,PASS),BLKSIZE=0,RECFM=FB,LRECL=84
//T2 DD DSN=&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),
// DISP=(,PASS),BLKSIZE=0,RECFM=FB,LRECL=84
//CON DD DSN=&T1,DISP=(OLD,PASS),VOL=REF=*.T1
// DD DSN=&T2,DISP=(OLD,PASS),VOL=REF=*.T2
//OUT DD DSN=Out file ,DISP=(MOD,KEEP,KEEP)
//*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T2) USING(CTL2)
SPLICE FROM(CON) TO(OUT) ON(81,4,ZD) WITH(45,8)
//CTL1CNTL DD *
OPTION COPY,STOPAFT=1
INCLUDE COND=(11,4,CH,EQ,C'HRDR')
OUTREC FIELDS=(1:44X,45:19,8,54:26X,81:C'0008')
//CTL2CNTL DD *
OUTREC FIELDS=(1:1,80,SEQNUM,4)
/*

Issues:
CTL1CNTL extracts well !
CTL2CNTL says syntax error (cant think why) !
Also SPLICE would map on the key 81,4 which is seqnum. But I would need all records

Is it possible in these lines?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 31, 2006 5:32 am
Reply with quote

My job works fine with DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
jpreethi

New User


Joined: 31 Oct 2006
Posts: 10

PostPosted: Tue Oct 31, 2006 5:40 am
Reply with quote

I still intend to use the ICETOOL which I depend on very much.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 31, 2006 5:58 am
Reply with quote

Since you're using Syncsort, you're using Syncsort's SYNCTOOL, not DFSORT's ICETOOL. Note that Syncsort's SYNCTOOL is undocumented, whereas DFSORT's ICETOOL is fully documented. Be aware that when you look at the documentation for DFSORT's ICETOOL, it won't necessarily apply to Syncsort's SYNCTOOL.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top