Inserting a Delimiter
Moderators: Frank Yaeger, DikDude, Moderator Group
-
- Member
- Posts: 7
- Joined: Sat Mar 21, 2009 8:37 pm
Inserting a Delimiter
Hi All,
I need to insert a delimiter(|) between two columns, when a file is generated after successful JCL submission.
Eg. File1:
EMP# EMPNAME EMPEXPER
111 AAAA 1
1112 BC 10
12 DBAC 2
This should be converted into
EMP#|EMPNAME|EMPEXP
111|AAAA|1
1112|BC|10
12|DBAC|2
What are the steps to be included in a JCL for this conversion?
Thanks In advance,
Rekha.
I need to insert a delimiter(|) between two columns, when a file is generated after successful JCL submission.
Eg. File1:
EMP# EMPNAME EMPEXPER
111 AAAA 1
1112 BC 10
12 DBAC 2
This should be converted into
EMP#|EMPNAME|EMPEXP
111|AAAA|1
1112|BC|10
12|DBAC|2
What are the steps to be included in a JCL for this conversion?
Thanks In advance,
Rekha.
-
- Member
- Posts: 10
- Joined: Thu Mar 05, 2009 5:50 pm
- Location: Bangalore
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Rekha,
You can use a DFSORT job like the following to do what you asked for.
You can use a DFSORT job like the following to do what you asked for.
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
EMP# EMPNAME EMPEXPER
111 AAAA 1
1112 BC 10
12 DBAC 2
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C'|'))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Kapil,I think you can acheive this by writing a simple cobol program and this is not possible to do by jcl.
You're obviously not aware of the capabilities of DFSORT. I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/servers/storage/support/sof ... tmpub.html
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Hi Frank.
What does this convey to DFSort in above JCL? Please assist.
What does this
Code: Select all
MID=C'|'))
Regards,
Anuj
Anuj
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
MID=C'|' tells DFSORT to insert a '|' character between the fields.
Paraphrasing from the "z/OS DFSORT Application Programming Guide" description of p,m,squeeze:
MID=string
specifies a string to be inserted in the output field wherever one or more blanks is removed between the first nonblank and the last nonblank. string can be 1 to 10 characters specified using a character string constant (C'xx...x') or a hexadecimal string constant (X'yy...yy'). For example, let's say we have an input field of:
If we specify:
the output field is:
...
You can access all of the DFSORT books online from:
www.ibm.com/systems/support/storage/sof ... tmpub.html
Paraphrasing from the "z/OS DFSORT Application Programming Guide" description of p,m,squeeze:
MID=string
specifies a string to be inserted in the output field wherever one or more blanks is removed between the first nonblank and the last nonblank. string can be 1 to 10 characters specified using a character string constant (C'xx...x') or a hexadecimal string constant (X'yy...yy'). For example, let's say we have an input field of:
Code: Select all
AB C D E
Code: Select all
1,12,SQZ=(SHIFT=LEFT,MID=C',')
Code: Select all
AB,C,D,E
You can access all of the DFSORT books online from:
www.ibm.com/systems/support/storage/sof ... tmpub.html
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Compare them and do what?Is it possible to compare both files?
Show a more complete example of the records in each input file and what you expect for output. Explain the "rules" for comparing the files. Are you looking for a match between all three fields in any record of file1 and file2, or what?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Thankyou Frank for such an explanation - You are a good Teacher as well . . . .
Just out of curiosity: MID is an abbreviation for "middle"?
Just out of curiosity: MID is an abbreviation for "middle"?
Last edited by Anuj Dhawan on Tue Mar 24, 2009 8:58 pm, edited 1 time in total.
Regards,
Anuj
Anuj
-
- Member
- Posts: 7
- Joined: Sat Mar 21, 2009 8:37 pm
File1 is captured from the SPOOL output which will have space between entire column.
For EG. Customer ID is 10 digit number. But i can have Customer ID as 555 hence while displaying in the SPOOL, it leaves 7 more spaces and then value for the next column begins.
(precisely, it looks like output of a query which is run in SPUFI and which is viewed in the output PS.)
FIle 2 is a production file which has continuous column values. Eventhough customer ID is 10 in length, if the ID is 555 then no space is allocated. ID is immediately proceeded by the next value.
I need to compare these two files and get the unique records of File 1 in 1 file and unique records in File 2 in another File.
Hope i have given detailed explanation.
For EG. Customer ID is 10 digit number. But i can have Customer ID as 555 hence while displaying in the SPOOL, it leaves 7 more spaces and then value for the next column begins.
(precisely, it looks like output of a query which is run in SPUFI and which is viewed in the output PS.)
FIle 2 is a production file which has continuous column values. Eventhough customer ID is 10 in length, if the ID is 555 then no space is allocated. ID is immediately proceeded by the next value.
I need to compare these two files and get the unique records of File 1 in 1 file and unique records in File 2 in another File.
Hope i have given detailed explanation.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Anuj,
Yes, MID is an abbreviation for MIDDLE.
sasirekha V,
Again:
Yes, MID is an abbreviation for MIDDLE.
sasirekha V,
Again:
Show a more complete example of the records in each input file and what you expect for output.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 7
- Joined: Sat Mar 21, 2009 8:37 pm
File 1:(has space between columns)
<first some 10 lines about execution of a query NOT REQUIIERD>
EMP# |EMPNAME |EMPEXP
111 |AAAA |1
1112 |BC |10
File 2:(No space between columns)
<Header-List of coulmn names EMP#|EMPNAME|EMPEXPR>
111|AAAA|1
1112|BC|12
12|DBAC|2
Com File 1: Unique records in File1 (No space between columns)
1112|BC|10
Com File 2: Unique records in File2 (No space between columns)
1112|BC|12
12|DBAC|2
<first some 10 lines about execution of a query NOT REQUIIERD>
EMP# |EMPNAME |EMPEXP
111 |AAAA |1
1112 |BC |10
File 2:(No space between columns)
<Header-List of coulmn names EMP#|EMPNAME|EMPEXPR>
111|AAAA|1
1112|BC|12
12|DBAC|2
Com File 1: Unique records in File1 (No space between columns)
1112|BC|10
Com File 2: Unique records in File2 (No space between columns)
1112|BC|12
12|DBAC|2
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
What is the RECFM and LRECL of File1 and File2?
What is the RECFM and LRECL of Com File1 and Com File2?
What is the maximum length of the records to be compared, that is, how big can
field1|field2|field3
be?
It looks like there are 11 lines that can be ignored before the data starts in file1 - right?
How many lines can be ignored before the data starts in file2? That is, now many lines are represented by
<Header-List of coulmn names EMP#|EMPNAME|EMPEXPR>
What is the RECFM and LRECL of Com File1 and Com File2?
What is the maximum length of the records to be compared, that is, how big can
field1|field2|field3
be?
It looks like there are 11 lines that can be ignored before the data starts in file1 - right?
How many lines can be ignored before the data starts in file2? That is, now many lines are represented by
<Header-List of coulmn names EMP#|EMPNAME|EMPEXPR>
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 7
- Joined: Sat Mar 21, 2009 8:37 pm
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT/ICETOOL job that will do what I think you asked for.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD LRECL=23036,DSN=... output file1
//OUT2 DD LRECL=23036,DSN=... output file2
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(7,200,CH) KEEPNODUPS -
WITH(5,1) USING(CTL3)
/*
//CTL1CNTL DD *
OPTION SKIPREC=11
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,4,5:C'BB',7:5,200,SQZ=(SHIFT=LEFT)))
/*
//CTL2CNTL DD *
OPTION SKIPREC=1
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'VV',7:5,200))
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(5,2,CH,EQ,C'BB'),
BUILD=(1,4,5:7),VLTRIM=C' '
OUTFIL FNAMES=OUT2,INCLUDE=(5,2,CH,EQ,C'VV'),
BUILD=(1,4,5:7),VLTRIM=C' '
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page