Skip to main content

[archive] Memory alignment error

  • January 12, 2007
  • 2 replies
  • 0 views

[Migrated content. Thread originally posted on 11 January 2007]

First I'd like to wish everyone a Happy New Year.

We are converting from ALLBASE to Oracle. Now that we finally have finished developing a process that moves the tables across we have to change much of our embedded sql code to work with sqlplus. We are having a problem with the connection to Oracle via the embedded COBOL code.
This code:
MOVE "CONNECT TO ORACLE" TO DB-COMMAND
EXEC SQL
CONNECT :USR-PWD
END-EXEC
IF SqlCode = OK
MOVE 0 TO DB-COND-WORD
ELSE
PERFORM SQL-ERROR
END-IF.
Executing the program yields this error:
Memory alignment error

I've localized the problem soley to the CONNECT command.

We use this precompiler mode:
procob MODE=ANSI

And these compiler parameters:
ccbl -Zid -Z52 -Ca -Dw64 -Da4 -za -D5 -lfxo

Programs that don't have embeded sql compile and run fine.

Any suggestions?

Thanks in advance,
John C.

2 replies

[Migrated content. Thread originally posted on 11 January 2007]

First I'd like to wish everyone a Happy New Year.

We are converting from ALLBASE to Oracle. Now that we finally have finished developing a process that moves the tables across we have to change much of our embedded sql code to work with sqlplus. We are having a problem with the connection to Oracle via the embedded COBOL code.
This code:
MOVE "CONNECT TO ORACLE" TO DB-COMMAND
EXEC SQL
CONNECT :USR-PWD
END-EXEC
IF SqlCode = OK
MOVE 0 TO DB-COND-WORD
ELSE
PERFORM SQL-ERROR
END-IF.
Executing the program yields this error:
Memory alignment error

I've localized the problem soley to the CONNECT command.

We use this precompiler mode:
procob MODE=ANSI

And these compiler parameters:
ccbl -Zid -Z52 -Ca -Dw64 -Da4 -za -D5 -lfxo

Programs that don't have embeded sql compile and run fine.

Any suggestions?

Thanks in advance,
John C.
I am not so familiar with this, but one thing I notice, is that you compile with 64bit word size (-Dw64) but align over 4 bytes (-Da4). When you have 64bit word size, the alignment usually is 8.

[Migrated content. Thread originally posted on 11 January 2007]

First I'd like to wish everyone a Happy New Year.

We are converting from ALLBASE to Oracle. Now that we finally have finished developing a process that moves the tables across we have to change much of our embedded sql code to work with sqlplus. We are having a problem with the connection to Oracle via the embedded COBOL code.
This code:
MOVE "CONNECT TO ORACLE" TO DB-COMMAND
EXEC SQL
CONNECT :USR-PWD
END-EXEC
IF SqlCode = OK
MOVE 0 TO DB-COND-WORD
ELSE
PERFORM SQL-ERROR
END-IF.
Executing the program yields this error:
Memory alignment error

I've localized the problem soley to the CONNECT command.

We use this precompiler mode:
procob MODE=ANSI

And these compiler parameters:
ccbl -Zid -Z52 -Ca -Dw64 -Da4 -za -D5 -lfxo

Programs that don't have embeded sql compile and run fine.

Any suggestions?

Thanks in advance,
John C.
Thanks for the suggestion. However, we found the answer and it's more confusing then the original problem. It seems that the embedded sql requires that the name of the program that the code is embedded in be at least 7 characters. So a program named abc123.sql returns a memory error when it encounters the first embedded sql. But the exact same program renamed abc1234.sql does not. Has anyone encountered this anomaly? We find no documentation addressing this issue.

Thanks,
John