I would liker to see how we can use INCLUDE COND to get data extracted from three segments in a file.
Fields 1 and 2 that I am interested in the file are in a segment named CZ0 which starts in position 1 for a length of 3 in the file.
Fields 3 that I need is in another segment named CA0 in the same file which also starts in position 1 for a length of 3.
Fields 4 that I am looking for is in another segment in the file AX0 which also starts in position one for a length of 3.
Field 1 is for a length of 3 bytes and it starts in position 63 in the file.
Field 2 is for a length of 7 bytes starting in position 55
Field 3 is for a length of 15 bytes starting in position 190
Field 4 is for a length of 10 bytes starting in position 350.
How can I create the output with the four fields that I am interested in? Since the fields are not in the same segment, I have difficulty in getting the output correctly. Any help will be appreciated.
Include Statement andf sorting from more than one segment
-
- Posts: 12
- Joined: Sun Oct 17, 2010 12:06 am
- Skillset: COBOL/CICS/DB2/JCL
- Referer: Internet
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Include Statement andf sorting from more than one segmen
What have you got so far?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Posts: 12
- Joined: Sun Oct 17, 2010 12:06 am
- Skillset: COBOL/CICS/DB2/JCL
- Referer: Internet
Re: Include Statement andf sorting from more than one segmen
//STEP002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file1
// DD DSN=Input file 2
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,3,CH,EQ,C'CZ0'),AND,
(1,3,SS,EQ,C'CA0'),OR
(1,3,SS,EQ,C'AX0'))
when I run the job, it creates out from field 4 only, ignoring fields 1 thru 3.
OUTRECFIELDS=(63,3,x,55,7,X,190,15,X,350,10,X)
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file1
// DD DSN=Input file 2
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,3,CH,EQ,C'CZ0'),AND,
(1,3,SS,EQ,C'CA0'),OR
(1,3,SS,EQ,C'AX0'))
when I run the job, it creates out from field 4 only, ignoring fields 1 thru 3.
OUTRECFIELDS=(63,3,x,55,7,X,190,15,X,350,10,X)
/*
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Include Statement andf sorting from more than one segmen
tdanielxyz wrote:I would liker to see how we can use INCLUDE COND to get data extracted from three segments in a file.
Fields 1 and 2 that I am interested in the file are in a segment named CZ0 which starts in position 1 for a length of 3 in the file.
Fields 3 that I need is in another segment named CA0 in the same file which also starts in position 1 for a length of 3.
Fields 4 that I am looking for is in another segment in the file AX0 which also starts in position one for a length of 3.
Field 1 is for a length of 3 bytes and it starts in position 63 in the file.
Field 2 is for a length of 7 bytes starting in position 55
Field 3 is for a length of 15 bytes starting in position 190
Field 4 is for a length of 10 bytes starting in position 350.
How can I create the output with the four fields that I am interested in? Since the fields are not in the same segment, I have difficulty in getting the output correctly. Any help will be appreciated.
A senseless bunch of words...
Please, re-explain for clarity, and give some examples of input and output records
So far, it sounds like a sort of bullshit.
Javas and Pythons come and go, but JCL and SORT stay forever.
Re: Include Statement andf sorting from more than one segmen
Basic info needed: sample of input and sample of desired output.
-
- Global moderator
- Posts: 3006
- Joined: Fri Apr 18, 2008 11:25 pm
- Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
- Referer: www.ibmmainframes.com
Re: Include Statement andf sorting from more than one segmen
Since the fields are not in the same segment
what in &hell is a segment ?

cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Posts: 12
- Joined: Sun Oct 17, 2010 12:06 am
- Skillset: COBOL/CICS/DB2/JCL
- Referer: Internet
Re: Include Statement andf sorting from more than one segmen
The input has CA0 and CZ0 and AX0 as the first three bytes as you can see below in row 4,5 and 14 below. I need to do the sort to get fields from input at positions 55 for 7 bytes, position 63 for 3 byes position 190 for 15 bytes and 350 for 10 bytes. The output file I want should have data as below. I have not displayed full records in the file below intentionally.
MNOX0070230X137192205464799X 1000273500
MNO from position 63-65, 0070230 from 55-61, 137192205464799 from 190 thru 205 and 1000273500 from 350 for 359. When I run the sort job shown, I am getting the data in split
in 3 lines. CA0 ,CZ0 and AX0 are in fact three segments in the file for a single claim and are related information and it repeats in the file for different claims.
Input file 1 has below data
000004 CA0 016-007108 OGARRO A BILLY
000005 CZ0 016-007108 RLSHK00000000000000ZPNA5014436230070230 MNO
000006 DA001016-007108 PF 87726
000007 DA201016-007108 NA
000008 EA0 016-007108
000009 EK0 016-007108 ABCD CLAIM
000010 FA001016-007108 201907312019073199018888
000011 HA001016-007108 PAT OWN FRAME-HIDE A BEVEL
000012 FA002016-007108 2019073120190731990199999
000013 HA002016-007108 PROG NATURAL PLY
000014 AX0 016-007108 020202020002010
000015 YA0000000000 MNOP0001 000000000 0000002000001400000
000016 BA0470917428 MNOP0001 470917428 E
000017 BA1470917428 MNOP0001 1415 N BROADWAY
000018 CA0 0000112382 NEWBORN ALISHA K 1952082
000019 CZ0020000112382 IC22 00000000000000 9282749740070926 MNO
MNOX0070230X137192205464799X 1000273500
MNO from position 63-65, 0070230 from 55-61, 137192205464799 from 190 thru 205 and 1000273500 from 350 for 359. When I run the sort job shown, I am getting the data in split
in 3 lines. CA0 ,CZ0 and AX0 are in fact three segments in the file for a single claim and are related information and it repeats in the file for different claims.
Input file 1 has below data
000004 CA0 016-007108 OGARRO A BILLY
000005 CZ0 016-007108 RLSHK00000000000000ZPNA5014436230070230 MNO
000006 DA001016-007108 PF 87726
000007 DA201016-007108 NA
000008 EA0 016-007108
000009 EK0 016-007108 ABCD CLAIM
000010 FA001016-007108 201907312019073199018888
000011 HA001016-007108 PAT OWN FRAME-HIDE A BEVEL
000012 FA002016-007108 2019073120190731990199999
000013 HA002016-007108 PROG NATURAL PLY
000014 AX0 016-007108 020202020002010
000015 YA0000000000 MNOP0001 000000000 0000002000001400000
000016 BA0470917428 MNOP0001 470917428 E
000017 BA1470917428 MNOP0001 1415 N BROADWAY
000018 CA0 0000112382 NEWBORN ALISHA K 1952082
000019 CZ0020000112382 IC22 00000000000000 9282749740070926 MNO
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Include Statement andf sorting from more than one segmen
Please use the code tags to present code and data - look at the difference below
You -
000004 CA0 016-007108 OGARRO A BILLY
000005 CZ0 016-007108 RLSHK00000000000000ZPNA5014436230070230 MNO
000006 DA001016-007108 PF 87726
000007 DA201016-007108 NA
000008 EA0 016-007108
000009 EK0 016-007108 ABCD CLAIM
000010 FA001016-007108 201907312019073199018888
000011 HA001016-007108 PAT OWN FRAME-HIDE A BEVEL
000012 FA002016-007108 2019073120190731990199999
000013 HA002016-007108 PROG NATURAL PLY
000014 AX0 016-007108 020202020002010
000015 YA0000000000 MNOP0001 000000000 0000002000001400000
000016 BA0470917428 MNOP0001 470917428 E
000017 BA1470917428 MNOP0001 1415 N BROADWAY
000018 CA0 0000112382 NEWBORN ALISHA K 1952082
000019 CZ0020000112382 IC22 00000000000000 9282749740070926 MNO
Me -
Also - do not post the line numbers unless you are referencing them.
You -
000004 CA0 016-007108 OGARRO A BILLY
000005 CZ0 016-007108 RLSHK00000000000000ZPNA5014436230070230 MNO
000006 DA001016-007108 PF 87726
000007 DA201016-007108 NA
000008 EA0 016-007108
000009 EK0 016-007108 ABCD CLAIM
000010 FA001016-007108 201907312019073199018888
000011 HA001016-007108 PAT OWN FRAME-HIDE A BEVEL
000012 FA002016-007108 2019073120190731990199999
000013 HA002016-007108 PROG NATURAL PLY
000014 AX0 016-007108 020202020002010
000015 YA0000000000 MNOP0001 000000000 0000002000001400000
000016 BA0470917428 MNOP0001 470917428 E
000017 BA1470917428 MNOP0001 1415 N BROADWAY
000018 CA0 0000112382 NEWBORN ALISHA K 1952082
000019 CZ0020000112382 IC22 00000000000000 9282749740070926 MNO
Me -
Code: Select all
000004 CA0 016-007108 OGARRO A BILLY
000005 CZ0 016-007108 RLSHK00000000000000ZPNA5014436230070230 MNO
000006 DA001016-007108 PF 87726
000007 DA201016-007108 NA
000008 EA0 016-007108
000009 EK0 016-007108 ABCD CLAIM
000010 FA001016-007108 201907312019073199018888
000011 HA001016-007108 PAT OWN FRAME-HIDE A BEVEL
000012 FA002016-007108 2019073120190731990199999
000013 HA002016-007108 PROG NATURAL PLY
000014 AX0 016-007108 020202020002010
000015 YA0000000000 MNOP0001 000000000 0000002000001400000
000016 BA0470917428 MNOP0001 470917428 E
000017 BA1470917428 MNOP0001 1415 N BROADWAY
000018 CA0 0000112382 NEWBORN ALISHA K 1952082
000019 CZ0020000112382 IC22 00000000000000 9282749740070926 MNO
Also - do not post the line numbers unless you are referencing them.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Can i read output file created after SORTing in the same pgm
by savitha_y » Sat Feb 06, 2021 1:17 am » in IBM Cobol - 4
- 1609
-
by savitha_y
View the latest post
Tue Feb 09, 2021 7:11 pm
-
-
- 2
- 1429
-
by willy jensen
View the latest post
Sun Nov 13, 2022 9:02 pm
-
- 8
- 4262
-
by steve-myers
View the latest post
Sat Oct 16, 2021 8:59 pm
-
-
Splice JCL into one record for DD statement parms
by phcribb » Thu Nov 05, 2020 9:31 pm » in CLIST & REXX - 3
- 1957
-
by phcribb
View the latest post
Fri Nov 06, 2020 8:06 pm
-