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
 
SORT - Copy the Header(1st) & Trailer(last rec) of 1st

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

New User


Joined: 03 May 2007
Posts: 27
Location: India

PostPosted: Fri Oct 03, 2008 12:37 pm    Post subject: SORT - Copy the Header(1st) & Trailer(last rec) of 1st
Reply with quote

Dear All,

I need to copy the Header(1st record) & Trailer of the 1st file (Last Record) , and Merge the other detail records from both the files to the O/P file

1st File - Header 1,3,CH,EQ,C'000'
Details records
1,3,CH,EQ,C'999'

2nd File - Header 1,3,CH,EQ,C'000'
Details records
1,3,CH,EQ,C'999'


O/P File - Header 1,3,CH,EQ,C'000' ( From 1st File ONLY)
Details records ( SORT condition given as below)
1,3,CH,EQ,C'999' ( From 1st File ONLY).

I have the Sort Condition for the other detail records, I need to know What condition we need to give to Merge the Header & Trailer from 1st File ONLY). Curretly the detail records ar merged correctly, please let me know your ideas.

Thanks & Regards,
Nivasya



SYSIN === SORT FIELDS=(1,22,CH,A,37,2,CH,A)
INCLUDE COND=((36,1,CH,EQ,C'D',OR,36,1,CH,EQ,C'C'),AND,
(1,3,CH,EQ,C'545'),AND,(28,3,CH,EQ,C'433',OR,
28,3,CH,EQ,C'111',OR,28,3,CH,EQ,C'222',OR,
28,3,CH,EQ,C'546'))
SUM FIELDS=(39,9,PD)
Back to top
View user's profile Send private message

hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Fri Oct 03, 2008 1:53 pm    Post subject:
Reply with quote

You can do it with ICETOOL

Following JOB should work for you. I assumed your record length to be 80. Change it per your requirement

Code:


//S0001    EXEC PGM=ICETOOL                                           
//DFSMSG   DD SYSOUT=*                                               
//SYSPRINT DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//TOOLMSG  DD SYSOUT=*                                               
//OUT      DD SYSOUT=*                                               
//STATA    DD DSN=&&TEMP1,                                           
//            SPACE=(CYL,(10,10)),                                   
//            DISP=(MOD,PASS),DCB=(LRECL=80,BLKSIZE=8000)             
//TRL      DD DSN=&&TEMP1,                                           
//            SPACE=(CYL,(10,10)),                                   
//            DISP=(MOD,PASS),DCB=(LRECL=80,BLKSIZE=8000)             
//IN1      DD DISP=SHR,DSN=INFILE1                                   
//IN2      DD DISP=SHR,DSN=INFILE2                                   
//DUMMY    DD DUMMY                                                   
//TOOLIN   DD   *                                                     
  COPY FROM(IN1)  TO(DUMMY) USING(CTL1)                               
  COPY FROM(IN2)  TO(DUMMY) USING(CTL2)                               
  COPY FROM(STATA) TO(OUT) USING(CTL3)                               
  COPY FROM(TRL) TO(OUT)                                             
//CTL1CNTL DD *                                                       
 OUTFIL FNAMES=OUT,INCLUDE=(1,3,CH,EQ,C'000')                         
 OUTFIL FNAMES=TRL,INCLUDE=(1,3,CH,EQ,C'999')                         
 OUTFIL FNAMES=STATA,SAVE                                             
//CTL2CNTL DD *                                                       
 OUTFIL FNAMES=STATA,INCLUDE=(1,3,CH,NE,C'999',AND,1,3,CH,NE,C'000')   
//CTL3CNTL DD *                                                       
 SORT FIELDS=(1,22,CH,A,37,2,CH,A)                                     
 INCLUDE COND=((36,1,CH,EQ,C'D',OR,36,1,CH,EQ,C'C'),AND,               
 (1,3,CH,EQ,C'545'),AND,(28,3,CH,EQ,C'433',OR,                         
 28,3,CH,EQ,C'111',OR,28,3,CH,EQ,C'222',OR,                           
 28,3,CH,EQ,C'546'))                                                   
 SUM FIELDS=(39,9,PD)                                                 
/*
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 Oct 03, 2008 9:45 pm    Post subject:
Reply with quote

I couldn't get hchinnam's job to work, but even if it did work, it would be an inefficient solution. Here's a one pass DFSORT solution. I assumed the input files have RECFM=FB and LRECL=80, but the job could be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/80)
//       DD DSN=...  input file2 (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
   INCLUDE COND=(1,3,SS,EQ,C'000,999',OR,
      (36,1,SS,EQ,C'C,D',AND,1,3,CH,EQ,C'545',AND,
       28,3,SS,EQ,C'433,111,222,546'))
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
      IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),OVERLAY=(81:SEQNUM,1,ZD)),
      IFTHEN=(WHEN=(1,3,CH,EQ,C'999'),OVERLAY=(81:SEQNUM,1,ZD))
   SORT FIELDS=(81,1,CH,A,1,22,CH,A,37,2,CH,A)
   SUM FIELDS=(39,9,PD)
   OUTFIL OMIT=(81,1,CH,EQ,C'2'),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
nivasaya

New User


Joined: 03 May 2007
Posts: 27
Location: India

PostPosted: Mon Oct 06, 2008 3:28 pm    Post subject: SORT Usage
Reply with quote

Dear ALL,

Thanks a lot for your Kind Response Frank and Hchinnam.

I tried the above code in SORT- we are using SORT in our Lab.

I am not ablr to figure out the issue it is giving return Code 16.

Please sugest me if this solution works in 2 steps

1st STEP

1st SORT
SYSIN === SORT FIELDS=(1,22,CH,A,37,2,CH,A)
INCLUDE COND=((36,1,CH,EQ,C'D',OR,36,1,CH,EQ,C'C'),AND,
(1,3,CH,EQ,C'545'),AND,(28,3,CH,EQ,C'433',OR,
28,3,CH,EQ,C'111',OR,28,3,CH,EQ,C'222',OR,
28,3,CH,EQ,C'546'))
SUM FIELDS=(39,9,PD)

COPY to a &&TEMP file.

2nd STEP

2nd SORT

SORT FILEDS=COPY
INCLUDE COND=(1,3,CH,EQ,C'000' or 1,3,CH,EQ,C'999')
SUM FILEDS=NONE

Wil this work. or if there is any other easy, i need help from you all.

Thanks & Regards,
Nivasaya
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Mon Oct 06, 2008 6:27 pm    Post subject:
Reply with quote

Can post your DFSMSG from job that has failed. We will be able to help you. As Frank suggested if there is a way to do it one pass obviously that is efficient.
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Mon Oct 06, 2008 6:39 pm    Post subject:
Reply with quote

Frank Yaeger wrote:


I couldn't get hchinnam's job to work,



That would be because of CTL3CNTL I guess. I tested the idea with my own CTL3CNTL before posting and it worked fine. So I replaced my CTL3CNTL with OP's statements and posted it.
Back to top
View user's profile Send private message
nivasaya

New User


Joined: 03 May 2007
Posts: 27
Location: India

PostPosted: Mon Oct 06, 2008 6:58 pm    Post subject:
Reply with quote

Dear Frank and Hchinnam,
Please find the steps i have involved for the SORT pgm as we use this in our workshop which worked, but i need an effiecient way to code the below 3 steps to 1 / 2 step(s)

1st Step – As it is – COPY the recs as per the existing SORT CARD (NO inclusion of ‘000’, ‘999’)

2nd Step – Extract only the HDR & Trailer of 1st File

3rd Step – Merge the O/P of the 1st & 2nd Step.

This O/P will have the HDR & TRLR from 1st file and the Detail records as per the original SORT condition.

Please verify the SORT condition and request your expert Advice.


My JESYSMSG did not have much info, it says STEP was Excecuted with COND code as 16.

SYSOUT - i am not able to view- it says NO DATA SETS AUTHORISED'

usualy for other jobs i don't face this issue.
Thanks & Regards,
Venkat
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Mon Oct 06, 2008 8:07 pm    Post subject:
Reply with quote

nivasaya wrote:


but i need an effiecient way to code the below 3 steps to 1 / 2 step(s)



That is what Frank's JCL is doing. It does the JOB in one step and in one pass. And when I tested, it worked perfect.

Can you put an "S" on your job as shown below (in S;ST). and post all it's contents

Code:


  Display  Filter  View  Print  Options  Help                                                                                     
-----------------------------------------------------------------------------------------------------------
SDSF STATUS DISPLAY ALL CLASSES                         DATA SET DISPLAYED         
COMMAND INPUT ===>                                            SCROLL ===> CSR
NP   JOBNAME  JobID    Max-RC     Prty Queue      C  Pos  SAff  ASys Status            PrtDest           
s    JOBID79K JOB06118 CC 0000       1 PRINT      A  4300                              LOCAL
     JOBID79K JOB06112 JCL ERROR     1 PRINT      A  4296                              LOCAL
Back to top
View user's profile Send private message
nivasaya

New User


Joined: 03 May 2007
Posts: 27
Location: India

PostPosted: Tue Oct 07, 2008 8:32 pm    Post subject: Only SORT Untility- we use in our workshop
Reply with quote

I can give a few info about the JOB:

We use ONLY SORT Utility in our workshop.

Please let me know whether the above solution By Frank can be used in SORT utility

Thanks & Regards,
Nivisaya
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Tue Oct 07, 2008 8:35 pm    Post subject:
Reply with quote

nivasaya,

I think you got confused seeing PGM=ICEMAN. Both PGM=ICEMAN and PGM=SORT invokes the same module. You can use any of these.
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 Oct 07, 2008 9:19 pm    Post subject:
Reply with quote

Quote:
We use ONLY SORT Utility in our workshop.

Please let me know whether the above solution By Frank can be used in SORT utility


My solution uses the DFSORT utility. PGM=ICEMAN and PGM=SORT both invoke the sort utility used at your shop. Since you posted in the DFSORT Forum, I assume that's DFSORT.
Back to top
View user's profile Send private message
nivasaya

New User


Joined: 03 May 2007
Posts: 27
Location: India

PostPosted: Tue Oct 21, 2008 6:02 pm    Post subject:
Reply with quote

Thank you all for your kind help.

Thanks Frank, Arun , Hchinnam for you kind support.

Delivered the code on time.
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 JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

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