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
 
Copy a selected number of records from a part record value

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

New User


Joined: 07 Nov 2007
Posts: 25
Location: Mumbai

PostPosted: Thu Dec 13, 2007 9:06 pm    Post subject: Copy a selected number of records from a part record value
Reply with quote

Hi,

Can any one tell how can i copy selected number of records from particular record value(not the row number of record value) .. for example.

My input:

---
---
---
---
---
----
000004 ( i dont know the exact line number of this record)
000002
342354
856578
563456
567456
968567
546566


My out put should be

856578
563456
567456


Thanks,
Uday
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Dec 13, 2007 10:14 pm    Post subject:
Reply with quote

Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
000004                                                   
000002                                                   
342354                                                   
856578                                                   
563456                                                   
567456                                                   
968567                                                   
546566                                                   
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  INCLUDE COND=(1,6,ZD,EQ,856578,|,                     
                1,6,ZD,EQ,567456,|,                     
                1,6,ZD,EQ,563456)                       
  SORT FIELDS=COPY                                       
/*                                                       


SORTOUT:
Code:
856578
563456
567456
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Dec 13, 2007 10:16 pm    Post subject:
Reply with quote

also this SORT card could be used
Code:
//SYSIN    DD *                                   
  INCLUDE COND=(1,6,SS,EQ,C'856578,567456,563456')
  SORT FIELDS=COPY                                 
/*                                                 
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 Dec 13, 2007 11:40 pm    Post subject:
Reply with quote

Quote:
Can any one tell how can i copy selected number of records from particular record value(not the row number of record value) .. for example.


I don't understand what you mean by this or how it relates to your example. Krisprems assumed you just wanted to select records with particular values, but that doesn't seem to match this description.

If Krisprems hasn't guessed right, then you need to explain more clearly the rules for getting from input to output and how they apply to the example you showed.
Back to top
View user's profile Send private message
Uday Kumar R

New User


Joined: 07 Nov 2007
Posts: 25
Location: Mumbai

PostPosted: Fri Dec 14, 2007 2:43 pm    Post subject:
Reply with quote

Hi,

I thankful for you all to give your precious time.

Hi Frank,

May be my examples leads Krisprems to a wrong direction. May be I have to describe the problem in more clear manner. Here it is...


Say suppose a file consist of 1 million entries with no duplicates. I want to put 20000 sequential entries from this file to a new file, starting from the entry whose value matches with <XXXXXX>. So from this point of entry i want to copy the next 19999 entries into a output file. For example....


...........
...........
...........
...........
...........
...........
xxxxxxx ( Do not know the exact line number of xxxxxx entry)
300000 The next 19999 entries starting from the entry value (xxxxxxx) to be in my output file...
452345
674567
467567
454546
...........
...........
...........
...........
...........
...........



Output;

xxxxxxx
300000
452345
674567
467567
454546 plus the remaing entries until the count is 20000 ....


Since i donot know the row value of xxxxxxx, i am unable to use STARTREC in the sort input paramets.

I hope this will give more insight into my problem.

Regards,
Uday
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Dec 14, 2007 4:17 pm    Post subject:
Reply with quote

Try this ICETOOL solution
Code:
//*******************************************************             
//STEP001  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                       
......                                                                 
......                                                                 
......                                                                 
......                                                                 
XXXXXX                                                                 
300000                                                                 
452345                                                                 
674567                                                                 
467567                                                                 
454546                                                                 
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
 COPY FROM(IN1)  TO(OUT) USING(CP01)                                   
/*                                                                     
//CP01CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(93:SEQNUM,8,ZD)),         
        IFTHEN=(WHEN=(1,1,CH,EQ,C'XXXXXX'),                   
                OVERLAY=(93:SEQNUM,8,ZD)),                   
        IFTHEN=(WHEN=NONE,                                   
                OVERLAY=(101:SEQNUM,8,ZD,                     
                         93:93,8,ZD,SUB,101,8,ZD,M11,LENGTH=8,
                         101:SEQNUM,8,ZD,RESTART=(93,8)))     
 OUTFIL REMOVECC,INCLUDE=(93,8,ZD,EQ,1,&,101,8,ZD,LE,20000), 
 BUILD=(1,80)                                                 
/*                                                           


OUT
Code:
XXXXXX
300000
452345
674567
467567
454546
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 Dec 14, 2007 10:36 pm    Post subject:
Reply with quote

Krisprems is on the right track, but his solution gives one too many records and is a bit "off" in other ways. Here's a correct DFSORT/ICETOOL job. I assumed the input file has RECFM=FB and LRECL=80, but the job can be changed for other attributes.

Code:

//STEP001  EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD DSN=...  input file (FB/80)
//OUT      DD DSN=...  output file (FB/80)
//TOOLIN   DD *
COPY FROM(IN1) USING(CP01)
//CP01CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,6,CH,EQ,C'XXXXXX'),
                OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(89:SEQNUM,8,ZD,
                         81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8,
                         89:SEQNUM,8,ZD,RESTART=(81,8)))
  OUTFIL FNAMES=OUT,
   INCLUDE=(81,8,ZD,EQ,1,AND,(89,8,CH,EQ,C' ',OR,89,8,ZD,LE,+19999)),
   BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Uday Kumar R

New User


Joined: 07 Nov 2007
Posts: 25
Location: Mumbai

PostPosted: Mon Dec 17, 2007 5:22 pm    Post subject:
Reply with quote

Hi,

Thankyou kRISPREM & Frank for your detail explanation.

Regards
Uday
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 Sep 04, 2008 11:42 pm    Post subject:
Reply with quote

You can now do this more easily using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN   DD DSN=...  input file (FB/80)
//SORTOUT  DD DSN=...  output file (FB/80)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'XXXXXX'),
    RECORDS=20000,PUSH=(81:ID=1))
  OUTFIL INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
/*


For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

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