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
 
COBOL OCCURS and SORT statements.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
DB2 Guy

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Mon May 09, 2011 7:54 pm    Post subject: COBOL OCCURS and SORT statements.
Reply with quote

Hi,

Was looking at this thread and tryingto understand the logic from of control statements Frank has used in his post:
1. This
Code:
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
This just copy the input to output and when the initail condition arises in INREC.
2.
Code:
 PARSE=(%01=(ABSPOS=5,
    STARTAFT=C'SALE',STARTAFT=C'MGMT',FIXLEN=6),
Create " file-1, %1"- in which the the value should be picked up from 5th position of input (ABSloute POSition=5). However, what if we don't give the ABSPOS, as we are anyways using "STARTAFT=C'SALE',STARTAFT=C'MGMT',FIXLEN=6)". I tried removing that and get a user abend.

3. Other %n files are just similar.

4. So, we've created 9 intermediate files, in such a way that we get all the amoutn fields at some-fixed-postions; so that we can add them up later,right?

5. With these:
Code:
  BUILD=(1,3,%01,X'FF',%02,X'FF',%03,X'FF',%04,X'FF', %05,X'FF',%06,X'FF',%07,X'FF',%08,X'FF',%09,X'FF')),
We create a file in which we rearrange the intermediate files.
6. I did not get this -- why do we need this.
Code:
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,
    IN=X'404040404040FF',OUT=X'00000000000C00')),
I tried by removing it and did not get any change in the intermediate out put

7. I've used the example in the thread I was reffeerign as input - but with these I get a S0C7
Code:
  IFTHEN=(WHEN=INIT,
    BUILD=(1,3,4,6,PD,ADD,11,6,PD,ADD,18,6,PD,ADD,25,6,PD,ADD,
     32,6,PD,ADD,39,6,PD,ADD,46,6,PD,ADD,53,6,PD,ADD,60,6,PD,
     TO=PD,LENGTH=6))
/*


Can someone please help a bit more to understand this.
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon May 09, 2011 9:12 pm    Post subject:
Reply with quote

Read about parsing here

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

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Tue May 10, 2011 2:33 pm    Post subject: Reply to: COBOL OCCURS and SORT statements.
Reply with quote

Hi sqlcode1,

Thanks for your time and pointing to the manuals.

Actually, I did look at the manual before posting here and understand the parsing.

I'm looking forward to help from point 6 onwards.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue May 10, 2011 2:59 pm    Post subject:
Reply with quote

item 5:
lays x'ff's in 'strategic positions.

item 6:
the FINDREP creates a packed decimal area of zeroe where the x'40' followed by x'FF' was (from item 5).

item 7:
the packed-decimal add is to the columns that items 5 & 6 prepared as zeroe value PD areas.

if you left out 5 & 6, it is understandable the item 7 would S0C7.
you are adding to an unsigned area filled with X'40's
Back to top
View user's profile Send private message
DB2 Guy

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Tue May 10, 2011 4:12 pm    Post subject:
Reply with quote

Thanks Dick.

Quote:
if you left out 5 & 6, it is understandable the item 7 would S0C7.
you are adding to an unsigned area filled with X'40's
Yes, thsi is what I've also anticipated and tried removing the said steps. but, on ther other hand, the original example, using the Job as is, results in S0C7 -- and I'm not able to figure out the what position is not having numeric data.

I'll generate an intermediate file now (using BUILD=(1,3,%01,X'FF',%02,X'FF',%...) and execute verify command on that to see where is non-numeric value...
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 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 Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm

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