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
 
How to modify the first record alone using Sort.

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

New User


Joined: 21 Sep 2006
Posts: 5

PostPosted: Tue Jan 22, 2008 8:27 pm    Post subject: How to modify the first record alone using Sort.
Reply with quote

The input file is

01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC


I was just loooking for a way to add a pipe symbol to the first 3 records alone.


where the output should be

|01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
|02UPC|HEALTH_CONDITION
|03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC

Can you please guide me on this.

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

Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Tue Jan 22, 2008 9:22 pm    Post subject:
Reply with quote

What is the input record length? what should be the output record length.

I tried this one with input lrecl as 80.

Code:
//SRT80301 EXEC PGM=SORT                                               
//*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//*                                                                     
//SORTIN   DD DSN=YOUR.SORTIN.FILE,DISP=SHR                   
//SORTOUT  DD DSN=YOUR.SORTOUT.FILE,DISP=(NEW,CATLG,DELETE), 
//         SPACE=(TRK,(1,1)),DCB=*.SORTIN                               
//SYSIN    DD *                                                         
 SORT FIELDS=COPY                                                       
 INREC BUILD=(1,80,81:SEQNUM,8,ZD)                                     
 OUTREC IFTHEN=(WHEN=(81,8,ZD,LE,3),                                   
        BUILD=(1:C'|',2:1,80)),                                         
        IFTHEN=(WHEN=(81,8,ZD,GT,3),                                   
        BUILD=(1:1,80))                                                 
/*                                                                     
//                                                     
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: Tue Jan 22, 2008 10:39 pm    Post subject:
Reply with quote

Hema,

I assumed your input file has RECFM=FB and LRECL=80 and you want that for the output too, but the jobs can be changed for other attributes.

If the first three records can be identified by not having 'U' in position 1, then you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,NE,C'U'),
    BUILD=(C'|',1,79))
/*


If the first three records can only be identified as the first three records, then you can use a DFSORT job like this:

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=(81,8,ZD,LE,+3),BUILD=(C'|',1,79))
/*
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jan 22, 2008 11:31 pm    Post subject:
Reply with quote

Hemamalini Vasudevan
As per your sample i/p records i observerd that there is a PIPE(|) in 2nd position of every record other than the first 3 records....If that is the case u can use the below untested SORT card.

Code:
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
      IFTHEN=(WHEN=(2,1,CH,NE,C'|'),BUILD=(C'|',1,79))
/*
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: Tue Jan 22, 2008 11:38 pm    Post subject:
Reply with quote

Krisprems,

Your job is similar to my first job -it just checks a different value. This technique can be used for any value that will identify one set of records vs the other set of records.

Note that you don't need IFOUTLEN=80 since the input records are 80 bytes and the record you're building is 80 bytes.
Back to top
View user's profile Send private message
Hemamalini Vasudevan

New User


Joined: 21 Sep 2006
Posts: 5

PostPosted: Wed Jan 23, 2008 11:21 am    Post subject:
Reply with quote

Thanks a lot. Yes with INREC IFTHEN BUILD i was able to add PIPE to the first 3 records.

I tried all the options and it worked. Thanks a lot, i learned new syntax in sort.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jan 23, 2008 2:05 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
Krisprems,

Your job is similar to my first job
Infact i copy pasted your JOB and made the modifications icon_wink.gif
-it just checks a different value. This technique can be used for any value that will identify one set of records vs the other set of records.
I do agree, but i just thought that since we know how the records are in the sample i/p, we could avoid the sequence numbering.

Note that you don't need IFOUTLEN=80 since the input records are 80 bytes and the record you're building is 80 bytes.
Yes, i realised it ...(i didnt get a chance to test it....so..)
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 query to fetch record which has only ... maxsubrat DB2 2 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

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