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
 
DFSORT Split 1 record to get several records

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

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Sat Nov 18, 2006 8:50 am    Post subject: DFSORT Split 1 record to get several records
Reply with quote

Hi All

Can anyone provide me a logic using DFSORT to split 1 record to get several records & remove the

duplicate data

My input file has data:

Column 1 - 3????Column 11 - 13????Column 21 - 23
---------------????------------------????------------------
123????????????????????234????????????????????345
888????????????????????999????????????????????999
777????????????????????777????????????????????555

My output file should contain values like this

Column 1 - 3
---------------
123
234
345
555
777
888
999

I want to know if this logic can be implemented in JCL within a single DFsort step ? Thanks in advandce .
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Sat Nov 18, 2006 10:13 am    Post subject: Re: DFSORT Split 1 record to get several records
Reply with quote

Can you try with this job... till the big guy shows up with panacea...
Code:
//S010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFL DD DSN=RECORDS.INPUT.FILE,DISP=SHR
//TEMP DD DSN=RECORDS.TMP.FILE,DISP=MOD
//OUTF DD DSN=RECORDS.OUT.FILE,DISP=(,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(INFL) TO(TEMP) USING(CTL1)
SPLICE FROM(TEMP) TO(OUTF) ON(1,3,CH) USING(CTL2) KEEPNODUPS
/*
//CTL1CNTL DD *
   INREC BUILD=(1:1,3,4:11,3,7:21,3)
/*
//CTL2CNTL DD *
   OUTFIL OUTREC=(1,3,/,4,3,/,7,3)
/*
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Sat Nov 18, 2006 6:53 pm    Post subject:
Reply with quote

priyesh.agrawal

Did you try yo jcl ?
I can't test mine but I think I am close to the solution
Code:

//S010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFL DD DSN=RECORDS.INPUT.FILE,DISP=SHR
//TEMP DD DSN=RECORDS.TMP.FILE,DISP=MOD
//OUTF DD DSN=RECORDS.OUT.FILE,DISP=(,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(INFL) TO(TEMP) USING(CTL1)
SELECT FROM(TEMP) TO(OUTF) ON(1,3,CH) FIRST
/*
//CTL1CNTL DD *
   OUTFIL OUTREC=(1,3,/,11,3,/,21,3)
/*

Alain
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: Sat Nov 18, 2006 9:59 pm    Post subject:
Reply with quote

Hmmm ... I'm not sure what Priyesh was trying to do with SPLICE. Alain is very close, but his OUTFIL statement needs FNAMES=TEMP and MOD isn't needed for TEMP.

Here's a correct DFSORT/ICETOOL job:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(1,3,CH) FIRST
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,OUTREC=(1,3,/,11,3,/,21,3)
/*
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Sun Nov 19, 2006 12:43 am    Post subject:
Reply with quote

Frank,

I am not sure the jcl we post are always used as a 1 step job. That's why I prefer to code DISP=(,DELETE,DELETE) instead of PASS for temp files.
But of course you know that icon_smile.gif

alain
Back to top
View user's profile Send private message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Sun Nov 19, 2006 2:29 am    Post subject:
Reply with quote

Thank you all of you, especially Frank for DFSort statement OUTFIL FNAMES=T1,OUTREC=(1,3,/,11,3,/,21,3) . Have a great week-end !
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: Sun Nov 19, 2006 10:14 pm    Post subject:
Reply with quote

Quote:
I am not sure the jcl we post are always used as a 1 step job. That's why I prefer to code DISP=(,DELETE,DELETE) instead of PASS for temp files.


Alain,

I'm not following you.

Do you mean DISP=(,CATLG,DELETE) rather than DISP=(,DELETE,DELETE)?

I used a temporary data set for T1, so DISP=(,PASS) would work even with a 2-step job.

You used DISP=(,CATLG,DELETE) for the output data set which is fine. I didn't show the DISP for the output data set - I leave the output parameters up to the person using the job to set up (for all I know they want SYSOUT=*).
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Mon Nov 20, 2006 12:45 am    Post subject:
Reply with quote

Frank,

If we imagine a job with several steps and a temporary data set created in the 1st step coded with a DISP=(...,PASS), that means it will live, by default, until the end of the job. A temp data set in a sort step is, almost the time, never reused in a step that comes after. If 2nd step runs for hours, that means that the space used by the temp data set in the 1st step can not be reused for an other batch that runs in parallel. In a night batch processing such resources are very sollicited.The persons who ask for a dfsort solution could not be sensitized to optimize their production this way.
A DISP=(...,DELETE) will be always changed by a DISP=(...,PASS) if the need is required, never the opposite.

Alain
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: Mon Nov 20, 2006 5:27 am    Post subject:
Reply with quote

Quote:
A temp data set in a sort step is, almost the time, never reused in a step that comes after.


Hmmm ... I still don't see what this has to do with my job. I coded DISP=(,PASS) for T1 which was used for the COPY operator and SELECT operator in the same step. This is very common for ICETOOL jobs. If for some reason somebody had changed this to two ICETOOL steps the T1 data set would still be needed for both steps so DISP=(,PASS) should be ok.

Whenever I show jobs with DISP=(,PASS) I only do so when they need to be passed. I always thought that was the purpose of PASS.

Quote:
A DISP=(...,DELETE) will be always changed by a DISP=(...,PASS) if the need is required, never the opposite.


Perhaps you're discussing some finer point of JCL for a more general case? Are you saying that DISP=(,DELETE) should always be used in preference to DISP=(,PASS)? Are you saying that there's something wrong with coding DISP=(,PASS) for the job I showed, or are you worried that it might lead to coding DISP=(,PASS) in other situations where it isn't appropriate?
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Mon Nov 20, 2006 10:10 am    Post subject:
Reply with quote

Frank,
Code:

Hmmm ... I still don't see what this has to do with my job.

Nothing at all with your job. Something if people copies/pastes it to create a multiple step job.
Code:

If for some reason somebody had changed this to two ICETOOL steps the T1 data set would still be needed for both steps so DISP=(,PASS) should be ok.

I agree, and would be DISP=(,PASS) until the last step that requires it where a DISP=(,DELETE) should be coded.
In this jcl coding DISP=(,PASS) or DISP=(,DELETE) has no incidence because it is a one step job.
Code:

Are you saying that DISP=(,DELETE) should always be used in preference to DISP=(,PASS)?

What I have seen in many shops, is that some people don't try to make things efficient.
Code:

...are you worried that it might lead to coding DISP=(,PASS) in other situations where it isn't appropriate?

It is well said. I think that people who ask for a dfsort solution could have some lakes in jcl too. They could copy the jcl posted 'as is' into their production without being gene to code a DISP=(,PASS) instead of a DISP=(,DELETE). Something I would like not.
But it's only my point of view.

Alain
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: Mon Nov 20, 2006 9:25 pm    Post subject:
Reply with quote

Ok, I understand your point now.
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 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