View previous topic :: View next topic
|
Author |
Message |
pinkroses
New User
Joined: 07 Nov 2005 Posts: 19
|
|
|
|
Hi,
I have a requirement like this
First file: LRECL 10
Second file: LRECL 175
I have to match position 1,9 from both files and copy the file2 record to o/p record.I have to check the position 10 in file1 for character 'C' and if it is TRUE then i have to change the change the value of position (40,4) in file2.
This changed one should be a output record.
Can anyone help me regarding this? |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Please Explain what need to do?
1.Need to write cobol program
2.Need to wirte sort(Dfsort ..etc) |
|
Back to top |
|
|
pinkroses
New User
Joined: 07 Nov 2005 Posts: 19
|
|
|
|
Need to write sort only |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
pinkroses,
Please show an example of the records in your input files and the expected output records (just show the relevant fields). If input file1 can have duplicates within it (on positions 1-9), show that in your example. If input file2 can have duplicates within it (on positions 1-9), show that in your example.
Also, indicate exactly what you want 40,4 changed to when position 10 is 'C'. |
|
Back to top |
|
|
pinkroses
New User
Joined: 07 Nov 2005 Posts: 19
|
|
|
|
Frank,
No duplicates in both input records.
First record with LRECL 10: Format
AAA000000
AAA000006N
AAA000014N
Second record with LRECL 175: format. some of the fields are comp-3 values.
(1 to 12)AAC001010AAC
(32 to 46)D010101UCUSTYND other are comp-3 values'
If the first file conatins value 'C' in its tenth position i have to change the value of position (40,4) to eg ('CUST in above record) to 'PROP' |
|
Back to top |
|
|
pinkroses
New User
Joined: 07 Nov 2005 Posts: 19
|
|
|
|
Frank,
Output record will be of same format (LRECL :175)as second input file with changed value.
Thanks in advance,
pinkroses |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your example seems to have nothing to do with your words - I can't make heads or tails of it.
You say you "have to match position 1,9 from both files" but none of the records in file1 have the same value in positions 1-9 as the record in file2. File1 has AAA000000, AAA000006 and AAA000014, whereas file2 has AAC001010 - no match.
You say "If the first file conatins value 'C' in its tenth position", but none of the records in file1 has a C in its tenth position.
You need to step back and think about what you want to do, explain it and show me an example of input and output records that matches the explanation. |
|
Back to top |
|
|
pinkroses
New User
Joined: 07 Nov 2005 Posts: 19
|
|
|
|
Frank,
No duplicates in both input records.
First record with LRECL 10: Format
AAA000000
AAA000006N
AAA000014C
Second record with LRECL 175: format. some of the fields are comp-3 values.
(1 to 12)AAA000014AAA
(32 to 46)D010101UPROPND other are comp-3 values'
If the first file conatins value 'C' in its tenth position i have to change the value of position (40,4) to eg ('PROP in above record) to 'PBKR' |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I wish you had given a better example with matching records that have 'C' and don't have 'C' and shown the expected output. I'm going to guess that for the output file, you only want the records from file2 that have a match in file1. So if you had this:
File1 input
Code: |
AAA000000
AAA000006N
AAA000014C
AAA000020X
|
File2 input
Code: |
AAA000014AAA D010101UPROPND
AAA000020AAA D010101UPROPND
|
You'd want the following:
Output
Code: |
AAA000014AAA D010101UPBKRND
AAA000020AAA D010101UPROPND
|
Here's a DFSORT/ICETOOL job to do that:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/10)
//IN2 DD DSN=... input file2 (FB/175)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/175)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,9,CH) WITH(1,175) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(176:10,1)
/*
//CTL2CNTL DD *
INREC OVERLAY=(176:C' ')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,
IFOUTLEN=175,
IFTHEN=(WHEN=(176,1,CH,EQ,C'C'),OVERLAY=(40:C'PBKR'))
/*
|
|
|
Back to top |
|
|
pinkroses
New User
Joined: 07 Nov 2005 Posts: 19
|
|
|
|
Thanks for the reply frank.
But am getting an error and the sysout reads
Code: |
OPTION COPY
INREC OVERLAY=(176:10,1)
*
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
|
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
Oooops,
Pinkroses - I do believe that you have just incurred the wrath of Khan!
Expect the following from the master later today;
--
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.
--
All that effort and you are using a different tool. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
pink,
The job works fine with DFSORT, but the WER messages indicate you're using Syncsort, not DFSORT.
Quote: |
Pinkroses - I do believe that you have just incurred the wrath of Khan! |
No wrath - just sadness.
Quote: |
Expect the following from the master later today; |
What he said. |
|
Back to top |
|
|
|