Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extracting batch of records from file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sclater

New User


Joined: 22 Jun 2007
Posts: 14
Location: South Africa

PostPosted: Thu Mar 13, 2008 8:17 pm    Post subject: Extracting batch of records from file
Reply with quote

I need to extract a batch of records based on the value of a specific field in one of the records. The file is lrecl 2000 and FB


File layout:
1000Header
3000datarec1 field1
60PPdatarec2 field2
1000header
3000datarec3 field3
1200header
3000datarec4 field4
3004datarec5 field5

A batch starts with a header record and the next batch starts at the next header (no trailer to a batch). There is no header or trailer to the file. Headers are identified by 10,11 or 12 in position 1 and 2. Datarecs are all other records. The datarec with the field with the value I need to use to extract the batch is either 00 or PP in position 3 and 4

As an example, input file:

Code:
1000541283541283000000.......7104.Ø..                          .Ø..2 00000000000
3000552057541283      ....p&.710 .Ø..   2  M5520578340093272       .Ø.@....5 S 6
3004            01        LUTTIG/ALEXANDERMR                        .Ø.@77200281
3004            01        0745734720284 .Øø.               00                   
3000522126541283      ....f°.710 .Ø..   2  M5221266460461436       .Ø.@....5 S 6
3004            01        PRESTON/IAIN MR                           .Ø.@77200546
3004            01        0745679663096 .Ø.%               00                   
3000547120541283      ....êø.710 .Ø..   2  M5471204015740050       .Ø.@....5 S 7
3004            01        GROBLER/JANHENDRIKJNR                     .Ø.@77200885
3004            01        0744747543415 .Ø.æ               00                   
3000522100541283      ....-°.710 .Ø..   2  M5221008460665396       .Ø.@....5 S 6
3004            01        PARKINSON/RYANMR                          .Ø.@77203140
3004            01        0745734705020 .Ø/*               00                   
1000492213492213000000.......710H.Ø..                          .Ø..2 00000000000
3000600886492213      ....î.*710 .Ø..   2  L6008862280244205       .Ø.æ....5 S 9
5000600886492213      .....r.710 .Ø..   2  L6008862503125934       .Ø.æ....6 S 9
1000492213492213000000.......710H.Ø..                          .Ø..2 00000000000
3000600886492213      .....r*710 .Ø..   2  L6008862503167035       .Ø.æ....5 S 9
5000600886492213      .....r*710 .Ø..   2  L6008862503167035       .Ø.æ....6 S 9
60PP                  .......7102.Ø.æ....M  6008862284502103       00000       
1200492213492213000000.......710D.Ø..                          .Ø..2 00000000000
3100479056492213      .......710 .Ø..   2  V4790561101267539       .Ø.æ....5 S 0
3100503615492213      ......*710 .Ø..   2  M503615949570494011     .Ø.æ....5 S 0
3100501011492213      ....ç..710 .Ø..   2  M5010111154468518       .Ø.æ....5 S 0
3100501011492213      .....Á@710 .Ø..   2  M5010111166572109       .Ø.æ....5 S 0
3100501011492213      .....É<710 .Ø..   2  M5010111166572109       .Ø.æ....5 S 0
3100501011492213      .......710 .Ø..   2  M5010111152699791       .Ø.æ....5 S 0
3100479056492213      ....â..710 .Ø..   2  V4790561090094530       .Ø......5 S 0
1200492213492213000000.......710D.Ø..                          .Ø..2 00000000000
3100501011492213      ....g..710 .Ø..   2  M5010111168765909       .Ø......5 S 0
1200492213492213000000.......710D.Ø..                          .Ø..2 00000000000
3100501011492213      .....è.710 .Ø..   2  M5010111138013604       .Ø.æ....5 S 0
3100479056492213      ....ßî*710 .Ø..   2  V4790569004583191       .Ø.æ....5 S 0


I need to extract the batch with 503615949570494011 in position 45 as well as the batch with 6008862280244205 in position 45

Expected output:
Code:
1000492213492213000000.......710H.Ø..                          .Ø..2 00000000000
3000600886492213      ....î.*710 .Ø..   2  L6008862280244205       .Ø.æ....5 S 9
5000600886492213      .....r.710 .Ø..   2  L6008862503125934       .Ø.æ....6 S 9
1200492213492213000000.......710D.Ø..                          .Ø..2 00000000000
3100479056492213      .......710 .Ø..   2  V4790561101267539       .Ø.æ....5 S 0
3100503615492213      ......*710 .Ø..   2  M503615949570494011     .Ø.æ....5 S 0
3100501011492213      ....ç..710 .Ø..   2  M5010111154468518       .Ø.æ....5 S 0
3100501011492213      .....Á@710 .Ø..   2  M5010111166572109       .Ø.æ....5 S 0
3100501011492213      .....É<710 .Ø..   2  M5010111166572109       .Ø.æ....5 S 0
3100501011492213      .......710 .Ø..   2  M5010111152699791       .Ø.æ....5 S 0
3100479056492213      ....â..710 .Ø..   2  V4790561090094530       .Ø......5 S 0


Would this be possible with sort?
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Mar 13, 2008 9:25 pm    Post subject:
Reply with quote

You say "The datarec with the field with the value I need to use to extract the batch is either 00 or PP in position 3 and 4", but then you say "I need to extract the batch with 503615949570494011 in position 45 as well as the batch with 6008862280244205 in position 45".

I can't figure out from that what it is that determines if a "batch" should be selected. You need to clarify the "rules" you want to use to select the batches for output.
Back to top
View user's profile Send private message
sclater

New User


Joined: 22 Jun 2007
Posts: 14
Location: South Africa

PostPosted: Thu Mar 13, 2008 9:42 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
You say "The datarec with the field with the value I need to use to extract the batch is either 00 or PP in position 3 and 4", but then you say "I need to extract the batch with 503615949570494011 in position 45 as well as the batch with 6008862280244205 in position 45".

I can't figure out from that what it is that determines if a "batch" should be selected. You need to clarify the "rules" you want to use to select the batches for output.


The rules for a complete batch is that it stretches from the 10/11/12 record to the next. What I need to do is extract complete batches based on only one of the datarecords in the batch.

I should have said that I need to extract the complete batch with 503615949570494011 in position 45 of datarec 2 of that batch as well as the batch with 6008862280244205 in position 45 of datarec 1 of that batch.

Hope it makes sense.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Mar 13, 2008 10:04 pm    Post subject:
Reply with quote

I understood what a complete batch is.

What I didn't understand and still am not sure about based on your description is the rules for selecting a batch to kept .

Are you saying that the rule is that you want any batch that satisfies condition 1 or condition 2 as follows:

1. 503615949570494011 in position 45 of the third record of a batch (counting the header as the first record of the batch)

2. 6008862280244205 in position 45 of second record of a batch (counting the header as the first record of the batch)

Can there be more than one batch that satisfies condition1? If so, do you want to select all of the batches that satisfy condition1? Same for condition2.

Can you please run this job and show me the //SYSOUT messages you receive:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT  DD DUMMY
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(1,5,JFY=(SHIFT=LEFT))
Back to top
View user's profile Send private message
sclater

New User


Joined: 22 Jun 2007
Posts: 14
Location: South Africa

PostPosted: Thu Mar 13, 2008 10:30 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
Are you saying that the rule is that you want any batch that satisfies condition 1 or condition 2 as follows:

1. 503615949570494011 in position 45 of the third record of a batch (counting the header as the first record of the batch)

2. 6008862280244205 in position 45 of second record of a batch (counting the header as the first record of the batch)


503615949570494011 can be in any one of the records in the batch, not specifically the third record. Same with 6008862280244205. (lets call it customer number)

Frank Yaeger wrote:
Can there be more than one batch that satisfies condition1? If so, do you want to select all of the batches that satisfy condition1? Same for condition2.


Yes, there can be multiple batches and I need to keep all of them.

Frank Yaeger wrote:
Can you please run this job and show me the //SYSOUT messages you receive:


Code:
1ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED
 ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
 ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 18:48 ON THU MAR 13, 2008 -
0            OPTION COPY
             INREC BUILD=(1,5,JFY=(SHIFT=LEFT))
 ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
 ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E9-K90007 C9-BASE   E5-K24705 E7-K24705
 ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED
 ICE088I 0 N136206A.S1      .        , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
 ICE093I 0 MAIN STORAGE = (MAX,16777216,16763998)
 ICE156I 0 MAIN STORAGE ABOVE 16MB = (16686705,16686705)
 ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,RESET=Y,VSAMEMT=Y,DYNSPC=256
 ICE128I 0 OPTIONS: SIZE=16777216,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERET=RC16 ,MSGDDN=SYSOUT
 ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=SHORT,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N             ,ABCODE=MSG
 ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=N,STIMER=Y,COBEXIT=COB2
 ICE131I 0 OPTIONS: TMAXLIM=16777216,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=Y,DSA=0
 ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITCK=S,PARMDDN=DFSPARM ,FSZEST=N
 ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMIO=N,MOSIZE=MAX
 ICE235I 0 OPTIONS: NULLOUT=RC0
 ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
 ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
 ICE751I 1 EF-K10929 F0-Q84357 E8-K24705
 ICE090I 0 OUTPUT LRECL = 5, BLKSIZE = 80, TYPE = FB
 ICE171I 0 SORTOUT LRECL OF 5 IS DIFFERENT FROM SORTIN(NN) LRECL OF 80 - RC=0
 ICE055I 0 INSERT 0, DELETE 0
 ICE054I 0 RECORDS - IN: 1, OUT: 1
 ICE052I 0 END OF DFSORT
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Mar 13, 2008 11:09 pm    Post subject:
Reply with quote

Ok, I think I understand. Just one more question - are you only going to select batches for two customer numbers, or can it be more? If more, what's the approximate maximum number of customer numbers you'll want to use?
Back to top
View user's profile Send private message
sclater

New User


Joined: 22 Jun 2007
Posts: 14
Location: South Africa

PostPosted: Thu Mar 13, 2008 11:51 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
Ok, I think I understand. Just one more question - are you only going to select batches for two customer numbers, or can it be more? If more, what's the approximate maximum number of customer numbers you'll want to use?


Will probably end up around 200 (have got a list of 579 that still needs deduping, etc), but don't mind modifying and running the job multiple times (even 200 times icon_smile.gif ). Estimate there will be about 38.5 million datarecords in 7 million batches. icon_eek.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Mar 14, 2008 3:23 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/2000)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/2000)
//TOOLIN   DD    *
COPY FROM(IN) TO(T1) USING(CTL1)
SORT FROM(T1) USING(CTL2)
COPY FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(2001:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,2,SS,EQ,C'10,11,12'),
          OVERLAY=(2001:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=NONE,
          OVERLAY=(2009:SEQNUM,8,ZD,
                   2001:2001,8,ZD,SUB,2009,8,ZD,TO=ZD,LENGTH=8))
/*
//CTL2CNTL DD *
  INCLUDE COND=(45,18,CH,EQ,C'503615949570494011',OR,
                45,18,CH,EQ,C'6008862280244205')
  SORT FIELDS=(2001,8,ZD,A)
  SUM FIELDS=NONE
  OUTFIL FNAMES=CTL3CNTL,REMOVECC,
    HEADER1=('  INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,'),
    BUILD=(C'  2001,8,ZD,EQ,',2001,8,C',OR,',80:X),
    TRAILER1=('  1,1,CH,NE,1,1,CH)')
/*
//CTL3CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
Back to top
View user's profile Send private message
sclater

New User


Joined: 22 Jun 2007
Posts: 14
Location: South Africa

PostPosted: Fri Mar 14, 2008 1:36 pm    Post subject:
Reply with quote

Holly smokes, thanks Frank. I was expecting it to be a lot more complex than that (or atleast what I was trying on my own was). icon_lol.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us